格林模拟试题三(下)(8)
百度广告
what will happen when you attempt to compile and run the following code?
public class agg{static public long i=10;public static void main(string argv){ switch(i){ default: system.out.println("no value given"); case 1: system.out.println("one"); case 10: system.out.println("ten"); case 5: system.out.println("five"); } }}1) compile time error
3) output of "ten"
question 56)
given the following class
public class zeroprint{public static void main(string argv){ int i =0; //here }}which of the following lines if placed after the comment //here will print out 0.
1) system.out.println(i++);
3) system.out.println(i);
||| question 57)
given the following code
class base {}class agg extends base{ public string getfields(){ string name = "agg"; return name; }}public class avf{public static void main(string argv){ base a = new agg(); //here }}what code placed after the comment //here will result in calling the getfields method resulting in the output of the string "agg"?
1) system.out.println(a.getfields());
3) system.out.println((base) a.getfields());
编辑推荐:
温馨提示:因考试政策、内容不断变化与调整,长理培训网站提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准! (责任编辑:长理培训)
点击加载更多评论>>