+ 1

What is the default value of byte datatype in Java?

2nd Dec 2019, 4:59 PM
Farelian Abdul
Farelian Abdul - avatar
11 Respostas
+ 1
0
2nd Dec 2019, 5:07 PM
Avinesh
Avinesh - avatar
+ 4
0 is the default value
3rd Dec 2019, 11:53 AM
Lakshmipathi
Lakshmipathi - avatar
+ 1
It's null for string data type.
2nd Dec 2019, 5:28 PM
Avinesh
Avinesh - avatar
+ 1
Byte, short, int, long, float, double are all numeric data type so how can it have a character '0' as it's default type.
2nd Dec 2019, 5:34 PM
Avinesh
Avinesh - avatar
+ 1
Avinesh Thanks. I forgot instance variables. I mean the variables inside a code. Just print it without initializing would not work.
3rd Dec 2019, 8:10 AM
Denise Roßberg
Denise Roßberg - avatar
4th Dec 2019, 10:45 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
0
and is that same with String? because char identic with string??
2nd Dec 2019, 5:26 PM
Farelian Abdul
Farelian Abdul - avatar
0
but i still confusing why default value of byte datatype is 0 instead of '0' !!
2nd Dec 2019, 5:32 PM
Farelian Abdul
Farelian Abdul - avatar
0
ok now i know, thanks
2nd Dec 2019, 5:40 PM
Farelian Abdul
Farelian Abdul - avatar
0
You can also look here: http://www.c4learn.com/java/java-default-values/ Note: only static variables get default values
2nd Dec 2019, 11:59 PM
Denise Roßberg
Denise Roßberg - avatar
0
Denise Roßberg static and instance variables both get default values.
3rd Dec 2019, 2:47 AM
Avinesh
Avinesh - avatar