If x is an int where x 1 what will x be after the following
If x is an int where x = 1, what will x be after the following loop terminates? while (x
Solution
1. Answer:
int x=1;
while(x<10)
{
x *= 2;
}
Explanation: : here x=1, while(x<10) condition true so X= 1*2=2,
in second time x=2, while(x<10) condition true s0 x= 2*2=4,
X=4, while(4<10) true so x= 4*4=16 , and after condition false so output is X= 16
2.Answer:
C. It allows one to invoke a method within an object when given a reference to object.
Explanation : dot operator is used to access instance variables of an object eg:System.out.println(\"hello\");
3. Answer:
d. do
Explanation:
