Given: What is the result?
A.
c = null b = false f = 0.0F
B.
c = b = false f = 0.0
C.
c = 0 b = false f = 0.0f
D.
c = null b = true f = 0.0
Given: What is the result?
A.
c = null b = false f = 0.0F
B.
c = b = false f = 0.0
C.
c = 0 b = false f = 0.0f
D.
c = null b = true f = 0.0
Answer is correct because char has a unicode default value
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
B
c=0 b=false f=0.0
default value of char is (Blank space).
output will be :
c= b=false f=0.0
Output:
c =
c = false
c = 0.0
Code:
public class FieldInit {
char c;
boolean b;
float f;
public void printAll() {
System.out.println(“c = ” + c);
System.out.println(“c = ” + b);
System.out.println(“c = ” + f);
}
public static void main(String[] args) {
FieldInit fI = new FieldInit();
fI.printAll();
}
}