关于下面代码的说法()是正确的? publicclassExample{ publicstaticvoidmain(String[]args){ int[]arr=newint[10]; System.out.println(arr[1]); } }
关于下面代码的说法()是正确的? publicclassExample{ publicstaticvoidmain(String[]args){ int[]arr=newint[10]; System.out.println(arr[1]); } }
对于下列代码:publicclassExample{Stringstr=newString("hello");charch[]={'d','b','c'};publicstaticvoidmain(Stringargs[]){Exampleex=newExample();ex.change(ex.str,ex.ch); System.out.println(ex.str+"and"+ex.ch[0]); } publicvoidchange(Stringstr,charch[]){str="world";ch[0]='a';}}输出结果是:
对于下列代码:publicclassExample{Stringstr=newString("hello");charch[]={'d','b','c'};publicstaticvoidmain(Stringargs[]){Exampleex=newExample();ex.change(ex.str,ex.ch); System.out.println(ex.str+"and"+ex.ch[0]); } publicvoidchange(Stringstr,charch[]){str="world";ch[0]='a';}}输出结果是:
阅读下段代码importjava.io.*;publicclassExample{publicstaticvoidmain(String[]args)throwsException{FileInputStreamfis=newFileInputStream("file.txt");FileOutputStreamfos=newFileOutputStream("copy_file.txt");intch=0;while((ch=fis.read())!=-1){fos.write(ch);}fos._______;fis.close();}}请说出下划线上,填写的方法名称
阅读下段代码importjava.io.*;publicclassExample{publicstaticvoidmain(String[]args)throwsException{FileInputStreamfis=newFileInputStream("file.txt");FileOutputStreamfos=newFileOutputStream("copy_file.txt");intch=0;while((ch=fis.read())!=-1){fos.write(ch);}fos._______;fis.close();}}请说出下划线上,填写的方法名称
阅读下列代码 publicclassExample{ publicstaticvoidmain(String[]args){ int[]srcArray={11,12,13,14}; int[]destArray={21,22,23,24}; System.arraycopy(srcArray,1,destArray,2,2); for(inti=0;i<destArray.length;i++){ System.out.print(destArray[i]+); } } } 下列选项中,程序的运行结果是()
阅读下列代码 publicclassExample{ publicstaticvoidmain(String[]args){ int[]srcArray={11,12,13,14}; int[]destArray={21,22,23,24}; System.arraycopy(srcArray,1,destArray,2,2); for(inti=0;i<destArray.length;i++){ System.out.print(destArray[i]+); } } } 下列选项中,程序的运行结果是()
阅读下列代码importjava.io.*;publicclassExample{publicstaticvoidmain(String[]args)throwsException{FileInputStreamin=newFileInputStream("itcast.txt");intb=0;while(true){b=in.______;if(b==-1){break;}System.out.println(b);}in.close()}}下列选项中,填写在程序空白处正确的是()
阅读下列代码importjava.io.*;publicclassExample{publicstaticvoidmain(String[]args)throwsException{FileInputStreamin=newFileInputStream("itcast.txt");intb=0;while(true){b=in.______;if(b==-1){break;}System.out.println(b);}in.close()}}下列选项中,填写在程序空白处正确的是()
阅读下列程序publicclassExample{publicstaticvoidmain(String[]args){ArrayListlist=newArrayList();//创建ArrayList集合list.add("Tom");//向该集合中添加字符串list.add("Jerry");list.add("Donald");ListIteratorit=list.listIterator();while(it.hasNext()){Objectobject=it.next();if("Jerry".equals(object)){it.set("Speike");}}System.out.println(list);}}程序的运行结果是()
阅读下列程序publicclassExample{publicstaticvoidmain(String[]args){ArrayListlist=newArrayList();//创建ArrayList集合list.add("Tom");//向该集合中添加字符串list.add("Jerry");list.add("Donald");ListIteratorit=list.listIterator();while(it.hasNext()){Objectobject=it.next();if("Jerry".equals(object)){it.set("Speike");}}System.out.println(list);}}程序的运行结果是()
阅读下面的代码:publicclassExample{publicstaticvoidmain(String[]args){String[]strs={"Tom","Jerry","Donald"};//foreach循环遍历数组for(Stringstr:strs){str="Tuffy";}System.out.println(strs[0]+","+strs[1]+","+strs[2]);}}程序的运行结果是() A: Tom,Jerry B: Tom,Jerry,Tuffy C: Tom,Jerry,Donald D: 以上都不对
阅读下面的代码:publicclassExample{publicstaticvoidmain(String[]args){String[]strs={"Tom","Jerry","Donald"};//foreach循环遍历数组for(Stringstr:strs){str="Tuffy";}System.out.println(strs[0]+","+strs[1]+","+strs[2]);}}程序的运行结果是() A: Tom,Jerry B: Tom,Jerry,Tuffy C: Tom,Jerry,Donald D: 以上都不对