Important Core Classes(Object, String, Wrappers)

Important Core Classes(Object, String, Wrappers)

Previous Home Next

 

Java String Class :-is immutable, i.e. Strings in java, once created and initialized, cannot be changed in the program.
 
Wrapper class:- is a wrapper around a primitive data type. It represents primitive data types in their corresponding class instances

Java String Class :-is immutable, i.e. Strings in java, once created and initialized, cannot be changed in the program.The java.lang.String class (inbuilt package present in jdk library)differs from other classes,
 one difference being that the String objects can be used with the += and + operators for concatenation.

Wrapper class:-
is a wrapper around a primitive data type. It represents primitive data types in their corresponding class instances e.g. a boolean data type can be represented as a Boolean class instance. All of the primitive wrapper classes in Java are immutable i.e. once assigned a value to a wrapper class instance cannot be changed further within the program.
 Following table lists the primitive types and the corresponding wrapper classes:

Primitive Wrapper
boolean  - java.lang.Boolean
byte - java.lang.Byte
char - java.lang.Character
double - java.lang.Double
float - java.lang.Float
int - java.lang.Integer
long - java.lang.Long
short - java.lang.Short
void - java.lang.Void


 

Previous Home Next