22. Give following class:
class AClass{
private long val;
public AClass(long v){val=v;}
public static void main(String args[]){
AClass x=new AClass(10L);
AClass y=new AClass(10L);
AClass z=y;
long a=10L;
int b=10;
}
}
Which expression result is true?
A. a= =b;B. a= =x;C. y= =z;D. x= =y;
E. a= =10.0;
23. String s=”Example String”;
Which operation is legal?
A. s>;>;>;=3;B. int i=s.length();C. s[3]=“x”;
D. String short_s=s.trim();E. String t=“root”+s;
24. What happens when you try to compile and run the following program?
class Mystery{
String s;
public static void main(String[] args){
Mystery m=new Mystery();
m.go();
}
void Mystery(){
s=”constructor”;
}
void go(){
System.out.println(s);
}
}
A.this code will not compile
B.this code compile but throws an exception at runtime