对于如下代码,下列叙述正确的是。public class E {public static void main (String args[ ]) {String s1 = args[ 1 ];St ring s2 = args[2];St ring s3 = args[3];System.out.println(s3);}}
A. 程序出现编译错误
B. 无编译错误,在命令行执行程序“java E I love this game”,程序输出this
C. 无编译错误,在命令行执行程序“java E let us go”,程序无运行异常
D. 无编译错误,在命令行执行程序“java E 0 1 2 3 4 5 6 7 8 9”,程序输出3
查看答案
挑错题(A、B、C、D注释标注的哪行代码有错误?)填空栏只填写A、B、C和D字母之一。public class E {public static void main (String[ ] args) {String str = new String("ABCABC");int m = str.equals("");//Abyte [] b = str. getBytes(); //BStrings = str. substring( 1);//Cchar [ ] c = str.toCharArray();//D}}
挑错题(A、B、C、D注释标注的哪行代码有错误?)填空栏只填写A、B、C和D字母之一。public class E {public static void main (String[ ]args) {String s = new String( "ABCABC");boolean m = s. equals(""); //As = s. replaceAll(" [ ABC] +", " * * "); //Bs = s. substring(1); //Cint n = s. length ; //DSystem.out.println(s);}}
挑错题(A、B、C、D注释标注的哪行代码有错误?)填空栏只填写A、B、C和D字母之一。public class E {public static void main (String[ ]args) {String str1= new String(" "); //Aint [ ] a = {97,98,99};String str2 = new String (a); //Bchar [ ] c = {'a', 'b', 'c'};String str3 = new String (c);//CString str4 = new String();//DSystem.out.println(str4. equals(" "));}}
阅读程序题(给出【代码】注释标注的代码的输出结果)import java. util. * ;public class E {public static void main(String args[ ]) {String str ="现在时间是20:58:18";str = str.replaceAll(" [^ 0 - 9 : ] + "," ");StringTokenizerfenxi=new StringTokenizer(str,”:”);inth = Integer.parseint(fenxi.nextToken());int m = Integer.parseint(fenxi.nextToken());int s = Integer.parselnt(fenxi. nextToken());System.out.printf (" % d: % d: % d", h,m, s); //【代码】}}