网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
设有类定义如下:
class InOut{
String s= new String("Between");
public void amethod(final int iArgs){
int iam;
class Bicycle{
public void sayHello(){
//Here
}
}
}
public void another(){
int iOther;
}
}
以下哪些语句可以安排在//Here处 ?
A. System.out.println(s);
B.System.out.println(iOther);
C. System.out.println(iam);
D. System.out.println(iArgs);
参考答案
更多 “ 设有类定义如下:class InOut{String s= new String("Between");public void amethod(final int iArgs){int iam;class Bicycle{public void sayHello(){//Here}}}public void another(){int iOther;}}以下哪些语句可以安排在//Here处 ?A. System.out.println(s);B.System.out.println(iOther);C. System.out.println(iam);D. System.out.println(iArgs); ” 相关考题
考题
( 17 )阅读下面程序public class OperatorsAndExpressions {void equalsMethod1(){String s1=new String("how are you");String s2=new String("how are you");System.out.println(s1==s2);}public static void main(String args[]){OperatorsAndExpressions perAndExp=new OperatorsAndExpressions();// 用于复合类型数据的 “ == ” 运算符OperAndExp. equalsMethod1();}}程序运行结果是A ) ==B ) trueC ) falseD ) equal
考题
下列语句输出结果为( )。 public class test\ { public static void main (String args[]) { String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1.equals(s2))); } }A.falseB.trueC.0D.1
考题
下列程序的执行结果是______。 public class Test9 { public static void main(String[] args) { String s1 = new String("I am a girl"); String s2 = new String("I am a girl"); System.out.println (s1.equal (s2)); } }A.trueB.假C.I amgirlD.都不正确
考题
阅读下面程序 public class OperatorsAndExpressions{ void equalsMethodl(){ String s1=new String("how are you"); String s2=new String("how are you"); System.out.println(s1==s2); } public static void main(String args[]){ OperatorsAndExpressionsOperAndExp=new OperatorsAndExpressions(); //用于复合类型数据的“==”运算符 OperAndExp.equalsMethod1(); } } 程序运行结果是A.=B.trueC.falseD.equal
考题
下列程序的执行结果是 public class Testff{ public static void main(String args[]){ String sl=new String("I am boy"); String s2=new String("I am boy"); System.out.println(sl==s2); } }A.真B.假C.I am boyD.都不正确
考题
下列代码的执行结果是( )。 public class Test{ public static void main String args[]){ String s1=new String("welcome"); String s2=new String("welcome"); System.out.println(s1==s2); System.out.println(s1.equals(s2)); } }A.false,falseB.false,trueC.true,trueD.true,false
考题
public class Something {public static void main(String[] args) {Something s = new Something();System.out.println("s.doSomething() returns " + doSomething());}public String doSomething() {return "Do something ...";}}看上去很完美。
考题
阅读下面程序 public class OperatorsAndExpressions { void equalsMethodl(){ String s1=new String("how are you"); String s2=new String("how are you"); System.out.println(s1==s2); } public static void main(String args[]){ OperatorsAndExpressions perAndExp=new OperatorsAndExpressions(); OperAndExp.equalsMethod1(); } } 程序运行结果是( )。A. ==B.trueC.假D.equal
考题
下列语句输出结果为( )。 public class test { public static void main(StringArgsl[]) { String s1=new String("How"); String s2=new String("How"); System.out.println(!(s1==s2)); } }A.falseB.trueC.1D.0
考题
下列代码段的执行结果是( )。 public class Test { public static void main(String args[ ]) { String s1= new String("hello"); String s2= new String("hello"); System.out.println(s1==s2); System.out.println(s1.equal(s2)); } }A.true falseB.true trueC.false trueD.false false
考题
有如下代码段 public class OperatorAndExceptions { public static void main(String args[ ] { int i=10,j=15; System.out.println(i==j); String s1 = new String("how are you!"); String s2=new String("how are you!"); System.out.println(s1==s2); } } 其输出为( )。A.true falseB.true trueC.false trueD.false false
考题
下列程序通过实现Runnable接口创建一个线程,选择正确的语句填入程序的横线处。 class MyRun implements Runnable { String str; MyRun(String s) { str = s; } public void run() System.out.println(str); } } public class ex40 { public static void main(String[] args) { String name = "实现阶段Runnable 接口"; MyRun my = new MyRun(name); Thread th = th. start ( ); } }A.new MyRun(my)B.new Thread()C.new Thread(my)D.Thread(my)
考题
以下程序的调试结果为?public class Outer{public String name = "Outer";public static void main(String argv[]){Inner i = new Inner();i.showName();}private class Inner{String name =new String("Inner");void showName(){System.out.println(name);}}}A.输出结果 OuterB.输出结果 InnerC.编译错误,因Inner类定义为私有访问D.在创建Inner类实例的行出现编译错误
考题
设有类定义如下:class Base{public Base(int i){}}public class MyOver extends Base{public static void main(String arg[]){MyOver m = new MyOver(10);}MyOver(int i){super(i);}MyOver(String s, int i){this(i);//Here}}以下哪条语句可以安排在//Here处 ?A.MyOver m = new MyOver();B.super();C.this("Hello",10);D.Base b = new Base(10);
考题
设有程序如下: public class jzh0319 { public static void main(String args[]) { subClass sc=new subClass(); } } class superClass { superClass() { System.out.println("父类");} } class subClass extends superClass { subClass() {System.out.println("子类"); } } 其输出结果只有一行。()此题为判断题(对,错)。
考题
设有程序如下: public class jzh0319 { public static void main(String args[]) { subClass sc=new subClass(); } } class superClass { superClass() { System.out.println("父类");} } class subClass extends superClass { subClass() {System.out.println("子类"); } } 其输出结果的第一行是:父类。()此题为判断题(对,错)。
考题
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?()
考题
Which two allow the class Thing to be instantiated using new Thing()?A、 public class Thing { }B、 public class Thing { public Thing() {} }C、 public class Thing { public Thing(void) {} }D、 public class Thing { public Thing(String s) {} }E、 public class Thing { public void Thing() {} public Thing(String s) {} }
考题
public class X { public X aMethod() { return this;} } public class Y extends X { } Which two methods can be added to the definition of class Y?()A、 public void aMethod() {}B、 private void aMethod() {}C、 public void aMethod(String s) {}D、 private Y aMethod() { return null; }E、 public X aMethod() { return new Y(); }
考题
public class X { public static void main (String[]args) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?() A、 The program runs and prints “Hello”B、 An error causes compilation to fail.C、 The program runs and prints “Hello world!”D、 The program runs but aborts with an exception.
考题
public class X { public static void main (Stringargs) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?() A、The program runs and prints “Hello”B、An error causes compilation to fail.C、The program runs and prints “Hello world!”D、The program runs but aborts with an exception.
考题
单选题public class X { public static void main (Stringargs) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?()A
The program runs and prints “Hello”B
An error causes compilation to fail.C
The program runs and prints “Hello world!”D
The program runs but aborts with an exception.
考题
单选题现有: class Tree { private static String tree = "tree "; String getTree () { return tree; } } class Elm extends Tree { private static String tree = "elm "; public static void main (String [] args) { new Elm() .go (new Tree()) ; } } void go (Tree t) { String s = t.getTree () +Elm.tree + tree + (new Elm() .getTree ()) ; System.out.println (s) ;} 结果为:()A
elm elm elm elmB
tree elm elm elmC
tree elm elm treeD
tree elm tree elm
考题
多选题Which two allow the class Thing to be instantiated using new Thing()?Apublic class Thing { }Bpublic class Thing { public Thing() {} }Cpublic class Thing { public Thing(void) {} }Dpublic class Thing { public Thing(String s) {} }Epublic class Thing { public void Thing() {} public Thing(String s) {} }
考题
单选题final class Tree { private static String tree = "tree "; String getTree() { return tree; } } class Elm extends Tree { private static String tree = "elm "; public static void main(String [] args) { new Elm().go(new Tree()); } void go(Tree t) { String s = t.getTree()+Elm.tree+tree+(new Elm().getTree()); System.out.println(s); } } 结果为:()A
elm elm elm elmB
tree elm elm elmC
tree elm tree elmD
编译失败
考题
填空题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 X { public static void main (String[]args) { string s = new string (“Hello”); modify(s); System.out.printIn(s); } public static void modify (String s) { s += “world!”; } } What is the result?()A
The program runs and prints “Hello”B
An error causes compilation to fail.C
The program runs and prints “Hello world!”D
The program runs but aborts with an exception.
热门标签
最新试卷