挑错题(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); //【代码】}}
阅读程序题(给出【代码】注释标注的代码的输出结果)public class E {public static void main (String[ ] args) {int m = 0;String regex = " [\\p{Punct}\\p{Blank}] + ";String [ ] s = "we are student, I am tehcher(hello) ".split(regex);m = s.length;System.out.printf (" % d: % s",m,s[m- 1]); //【代码】}}
阅读程序题(给出【代码】注释标注的代码的输出结果)public class E {public static void main (String[ ]args) {String str = new String ("苹果”);modify(str);System.out.println(str); //【代码】}public static void modify (String s) {s = s + ”好吃“;}}
阅读程序题(给出【代码】注释标注的代码的输出结果)import java.util.regex. * ;public class E {public static void main( String args[ ]) {String s = ”10月1日至11月6日禁止通行”;String regex =" [ 0 - 9 ] + [月曰] ";Pattern p = Pattern.compile(regex);Matcher m = p.matcher(s);int count = 0;String item ="";while(m.find()) {item = m.group ();count ++;}System.out.printf(" % d: %s",count,item);//【代码】}}