Which class is super class of every class

What is default value of local variables ?

Answer : Local variables stored on the stack and aren’t actually created until they have been initialized. If a local variable isn’t used then it doesn’t go on the stack. Member variables, however, are allocated in the heap, and so have a default placeholder (null reference or default primitive).

Please see below default values:

Data TypeDefault Value (for fields)
byte0
short0
int0
long0L
float0.0f
double0.0d
char‘\u0000’
String (or any object)  null
booleanfalse

Leave a Reply

Your email address will not be published. Required fields are marked *