+1

What is the default value of byte datatype in Java?

12/2/2019 4:59:01 PM

Farelian Abdul

11 Answers

New Answer

+1

+4

0 is the default value

+1

It's null for string data type.

+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.

+1

Avinesh Thanks. I forgot instance variables. I mean the variables inside a code. Just print it without initializing would not work.

0

and is that same with String? because char identic with string??

0

but i still confusing why default value of byte datatype is 0 instead of '0' !!

0

ok now i know, thanks

0

You can also look here: http://www.c4learn.com/java/java-default-values/ Note: only static variables get default values

0

Denise Roßberg static and instance variables both get default values.

0

Here is some codes that might help you.... https://code.sololearn.com/cIHjQqZuMsNK/?ref=app https://code.sololearn.com/cj6Bm8Oo9pAc/?ref=app https://code.sololearn.com/coMSfbV0L59Z/?ref=app