单选题public class Test { public static void replaceJ(string text) { text.replace (‘j’, ‘l’); } public static void main(String args[]) { string text = new String (“java”) replaceJ(text); system.out.printIn(text); } } What is the result?()A The program prints “lava”B The program prints “java”C An error at line 7 causes compilation to fail.D Compilation succeeds but the program throws an exception.
单选题
public class Test { public static void replaceJ(string text) { text.replace (‘j’, ‘l’); } public static void main(String args[]) { string text = new String (“java”) replaceJ(text); system.out.printIn(text); } } What is the result?()
A
The program prints “lava”
B
The program prints “java”
C
An error at line 7 causes compilation to fail.
D
Compilation succeeds but the program throws an exception.
参考解析
解析:
暂无解析
相关考题:
下列程序段的输出结果是【 】。public class Test {void printValue(int m) {do {System.out.println("The value is"+m);}while (--m>10);}public static void main (String args[]) {int i=10;Test t= new Test();t.printValue(i);}}
下列语句输出结果为( )。public class test{public static void main(String args[]){byte b=OXA;System.out.println(b);}}A.OXAB.AC.1D.10
下列程序的运行结果是【 】。public class Test {public static void main (String args[]) {String s1="hello!";System.out.println (s1.toUpperCase());}}
下列代码的执行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(7/2); } }A.3.5B.3C.3.0D.3.50
阅读下列代码 public class Test{ public static void main(String args[]){ System.out.println(89>>1); } } 其运行结果是A.44B.45C.88D.90
( 8 )阅读下列代码public class Test2{public static void main(String args[]){System.out.println(5/2);}}其执行结果是 【 8 】 。
请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”Class Test 【 15 】 {Public static void main (String[] arge){Test t = new Test();t.start();}Public void run(){System.out.println( “ Hello! ” );}
已知如下类说明: public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); // 程序代码… } } 如下哪个使用是正确的?() A.t.fB.this.nC.Test.mD.Test.n
下面程序的输出结果是什么? class C1{ static int j=0; public void method(int a){ j++; } } class Test extends C1{ public int method(){ return j++; } public void result(){ method(j); System.out.println(j+method()); } public static void main(String args[]){ new TeA.0B.1C.2D.3
下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}A.编译错误B.0C.1D.运行成功,但不输出
下列语句输出的结果为( )。 public class test { public static void main(String args[]) { byte b=OXA; System.out.println(b); } }A.OXAB.AC.1D.10
下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.
下列程序的输出结果是( )。 public class Test { public static void main (String[] args) { String s="hello"; s.replace ('r','m'); System.out.println(s); } }A.helloB.HELLOC.hemmoD.HEMMO
以下代码的输出结果?public class Test{int x=5;public static void main(String argv[]){Test t=new Test();t.x++;change(t);System.out.println(t.x);}static void change(Test m){m.x+=2;}} A. 7B. 6C. 5D. 8
以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public static void main(String args []) {new Demo().some(7);}}class Demo extends Test {int m=8;public void some(int x) {super.some(x);System.out.println(m);}}A.5B.8C.7D.无任何输出E.编译错误
执行以下代码,输出结果的结果是? () public class Test{ public String[] ss = new String[5]; public static void main(String[] args){ System.out.println(ss[1]); } } A、 nullB、 -1C、 编译时出错D、 运行时报错
Which declarations will allow a class to be started as a standalone program?() A、public void main(String args[])B、public void static main(String args[])C、public static main(String[] argv)D、final public static void main(String [] array)E、public static void main(String args[])
package test1; public class Test1 { static int x = 42; } package test2; public class Test2 extends test1.Test1 { public static void main(String[] args) { System.out.println(“x = “ + x); } } What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.
Public class test ( Public static void main (String args[]) ( System.out.printIn (6 ^ 3); ) ) What is the output?()
Public class test ( Public static void stringReplace (String text) ( Text = text.replace (‘j’ , ‘i’); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args[]} ( String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); BufferReplace (textBuffer); System.out.printLn (textString + textBuffer); ) ) What is the output?()
public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?() A、 NULLB、 Compilation fails.C、 The code runs with no output.D、 An exception is thrown at runtime.
public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
单选题public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?()A 0B 1C 2D Compilation fails.
填空题Public class test ( Public static void main (String args) ( System.out.printIn (6^3); ) ) What is the output? ()
单选题public class Test { public static void main(String[] args) { String str = NULL; System.out.println(str); } } What is the result?()A NULLB Compilation fails.C The code runs with no output.D An exception is thrown at runtime.
填空题Public class test ( Public static void stringReplace (String text) ( Text = text.replace („j„ , „i„); ) public static void bufferReplace (StringBuffer text) ( text = text.append (“C”) ) public static void main (String args ){ String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”); stringReplace (textString); BufferReplace (textBuffer); System.out.printIn (textString + textBuffer); } ) What is the output?()
单选题public class Test { public static void replaceJ(string text) { text.replace (‘j‘, ‘l‘); } public static void main(String args) { string text = new String (“java”) replaceJ(text); system.out.printIn(text); } } What is the result?()A The program prints “lava”B The program prints “java”C An error at line 7 causes compilation to fail.D Compilation succeeds but the program throws an exception.
单选题下列程序的运行结果是( )。class Shape{ public Shape(){ System.out.print("Shape"); }}class Circle extends Shape{ public Circle(){ System.out.print("Circle"); }}public class Test{ public static void main(String[]args){ Shape d=new Circle(); }}AShapeBCircleCShapeCircleD程序有错误