Submitted by c-admin on Tue, 05/28/2019 - 05:42
The following method will compile and run without any problems.
public void switchTest(byte x){
switch(x){
case 'b': // 1
default : // 2
case -2: // 3
case 80: // 4
}
}
Select 1 option
A. True
B. False
Submitted by c-admin on Tue, 05/28/2019 - 04:33
The following code snippet will not compile:
int i = 10;
System.out.println( i<20 ? out1() : out2() );
Assume that out1 and out2 have method signature: public void out1(); and public void out2();
Select 1 option
A. True
B. False
Submitted by c-admin on Tue, 05/28/2019 - 04:31
The following code snippet will print 'true'.
short s = Short.MAX_VALUE;
char c = s;
System.out.println( c == Short.MAX_VALUE);
Select 1 option
A. True
B. False
Submitted by heartin on Tue, 09/08/2015 - 13:17
class Test{
public static int[ ] getArray() { return null; }
public static void main(String[] args){
int index = 1;
try{
getArray()[index=2]++;
}
catch (Exception e){ } //empty catch
System.out.println("index = " + index);
}
}
Select 1 option
A. True
B. False
Pages