answersLogoWhite

0


Best Answer

Since in c language char take 1 byte in memory because it support limited no of character set. But in the whole universe there are very large no of character like japinise language support 126 character set . Java char support all the character set in the world so it take 2 byte in memory.

User Avatar

Antonette Beatty

Lvl 10
1y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Since in c language char take 1 byte in memory because it support limited no of character set. But in the whole universe there are very large no of character like japinise language support 126 character set . Java char support all the character set in the world so it take 2 byte in memory.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

char in Java is an unsigned 16 bit numerical value representing a two byte Unicode character actually represents Basic Multilingual Plane (BMP) code points, including the surrogate code points, or code units of the UTF-16 encoding).

Since you left it as default, your char is 0, or u\0000. This is the Unicode NULL value.

You can add chars and other integer values, because it is a number. Note that while int, char, short, and byte are all range-restricted in value, the JVM treats them as 32-bit numbers for storage and manipulation on host systems.

Of note is that char is unsigned, while all the other Java primitive numeric are signed.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

16 bits (unicode) or 2 bytes.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the default value of char in java?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you calculate ascii value in java?

char a = 'A'; System.out.println((int)a);


What is default value of Boolean type variable?

False will be the default value of the boolean datatype in java


What does a char store?

In JavaA char in Java is a 16-bit integer, which maps to a subset of Unicode.In C A char in C is an 8-bit integer, which maps to standard ASCII.Note that in both Java and in C you can use a char value like a normal integer type: char c = 48;


What is meant by a mandatory field?

a mandatory field in a database is one created in a table as "Not null". This means, there is a "rule" on the field that when data is inserted into the table, this field cannot be empty. If it is, then the insert errors. Here's part of a table definition in my database. These field are are required to be populated when inserting into this table. ATTR_DESC_01 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_02 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_03 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_04 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_05 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_06 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_07 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_08 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_09 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_10 CHAR(2) DEFAULT SYSTEM NOT NULL, PARTITION_NBR SMALLINT NO DEFAULT NOT NULL)


What is the difference between sign and unsign in Java?

Normally, signed and unsigned data types just refer to whether or not a value can be negative or not. An unsigned 4-bit value can be the values 0 to 15 A signed 4-bit value can be the values -8 to 7 However, there is no such thing as an unsigned value in Java*. All primitive types are signed by default and cannot change. *Note that technically a char value can be considered an unsigned type. The only way to see this is to declare a char with value '\uffff' (or 65535) and try to print it out as both a short and an int. If you try this with any other data types, the larger values will display the same as the smaller values. Not so with the char example.

Related questions

How do you calculate ascii value in java?

char a = 'A'; System.out.println((int)a);


What is default value of Boolean type variable?

False will be the default value of the boolean datatype in java


What is passed toward the method in java?

Java uses pass by value semantics by default.


What does a char store?

In JavaA char in Java is a 16-bit integer, which maps to a subset of Unicode.In C A char in C is an 8-bit integer, which maps to standard ASCII.Note that in both Java and in C you can use a char value like a normal integer type: char c = 48;


How many keywords in java 1.7?

abstract assert boolean break case catch char class const continue default


How many bits does a Java char contain?

16 bits. Java char values (and Java String values) use Unicode.


What is meant by a mandatory field?

a mandatory field in a database is one created in a table as "Not null". This means, there is a "rule" on the field that when data is inserted into the table, this field cannot be empty. If it is, then the insert errors. Here's part of a table definition in my database. These field are are required to be populated when inserting into this table. ATTR_DESC_01 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_02 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_03 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_04 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_05 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_06 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_07 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_08 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_09 CHAR(2) DEFAULT SYSTEM NOT NULL, ATTR_DESC_10 CHAR(2) DEFAULT SYSTEM NOT NULL, PARTITION_NBR SMALLINT NO DEFAULT NOT NULL)


What is the difference between sign and unsign in Java?

Normally, signed and unsigned data types just refer to whether or not a value can be negative or not. An unsigned 4-bit value can be the values 0 to 15 A signed 4-bit value can be the values -8 to 7 However, there is no such thing as an unsigned value in Java*. All primitive types are signed by default and cannot change. *Note that technically a char value can be considered an unsigned type. The only way to see this is to declare a char with value '\uffff' (or 65535) and try to print it out as both a short and an int. If you try this with any other data types, the larger values will display the same as the smaller values. Not so with the char example.


How to print a symbol in Java using the ASCII value?

In order to print a character using its ASCII value, you need to first assign it to a char value like this: char c = (char) 65; In this example, we are casting the int 65 to a char, which converts it to an 'A', since 65 is the ASCII value for the capital letter 'a'. Next, you can print it out if you want: System.out.println(c); That's pretty much all there is to it!


Which method is default by true in java?

I don't understand what you mean with "default by true"? Please clarify your question. A Java method can have zero or more parameters, and it must have one return value. Any of these can be declared as "boolean", in which case the value can be either true or false.


How do I turn Java on?

Install Java. It is "on" by default.


What are the different parameter passing methods used by c plus plus?

Pass by value, constant value, reference and constant reference. Pass by value is the default in C++ (pass by reference is the default in Java).