2: What will be the result of executing the following code?
public static void main(String args[]) { char digit = 'a'; for (int i = 0; i < 10; i++) { switch (digit) { case 'x' : { int j = 0; (j); } default : { int j = 100; (j); } } } int i = j; (i); }
Choices: What will be the result of executing the following code? public static void main(String args[]) { char digit = 'a'; for (int i = 0; i < 10; i++) { switch (digit) { case 'x' : { int j = 0; (j); } default : { int j = 100; (j); } } } int i = j; (i); } Choices: will be printed 11 times. code will pile because the variable i cannot be declared twice within the main() method. code will pile because the variable j cannot be declared twice within the switch statement. of these. 3: 下述程序代码中有语法错误的行是( )。 int i,ia[10],ib[10]; /*第一行*/ for (i=0;i<=9;i++) /*第2行*/ ia[i]=0; /*第3行*/ ib=ia; /*第4行*/ 下述程序代码中有语法错误的行是( )。 int i,ia[10],ib[10]; /*第一行*/ for (i=0;i<=9;i++) /*第2行*/ ia[i]=0; /*第3行*/ ib=ia; /*第4行*/
4: The following code is entire contents of a file called ,causes precisely one error pilation: class SubClass extends BaseClass{ } class BaseClass(){ String str; public BaseClass(){ (“ok”);} public BaseClass(String s){ str=s;}} public class Example{ public void method(){ SubClass s=new SubClass(“hello”); BaseClass b=new BaseClass(“world”); } }