以下程序能顺利通过编译: class student { String sno,sname; static void output() { this.toString(); } String toString() { retur。()此题为判断题(对,错)。

题目
以下程序能顺利通过编译: class student { String sno,sname; static void output() { this.toString(); } String toString() { retur。()

此题为判断题(对,错)。


相似考题
参考答案和解析
答案:错


更多“以下程序能顺利通过编译: class student { String sno,sname; static void output() { this.toString(); } String toString() { retur。() 此题为判断题(对,错)。”相关问题
  • 第1题:

    以下代码的输出结果?public class Test{public static void main(String argv[]){String x="hello";change(x);System.out.println(x);}static void change(String m){m=m+2;}}

    A. hello

    B. hello2

    C. 编译报错

    D. 运行报错,不能将串与整数相加


    正确答案:A

  • 第2题:

    以下程序能顺利通过编译: public class am_I_right { public static void main(String args[]) { this.toString(); } String toString() { retur。()

    此题为判断题(对,错)。


    答案:错

  • 第3题:

    以下语句能顺利通过编译: final class class1 { } class class2 extends class1 { } 。()

    此题为判断题(对,错)。


    答案:错

  • 第4题:

    以下语句能顺利通过编译: class class1 { private int i=5; //i为私有属性!! } public class class2 { public static void main(String args[]) { class1 cs1=new class1(); System.out.println(cs1.i); } } 。()

    此题为判断题(对,错)。


    答案:错

  • 第5题:

    设有程序如下: abstract class absclass { abstract void method1(); } class conclass extends absclass { public void method1() { System.out.println("子类");} } public class mainclass { public static void main(String args[]) { absclass ac1=new absclass(); //语句1 absclass ac2=new conclass(); //语句2 ac2.method1(); //语句3 } } 则main()方法中的第一条语句(即语句1)可以顺利通过编译。()

    此题为判断题(对,错)。


    答案:错

  • 第6题:

    { public static void main(String args[]) { System.out.println(MyClass1.data); } } class MyClass1 { int data=10; } 。()

    此题为判断题(对,错)。


    答案:错

  • 第7题:

    给定如下Java程序片断:  class A{  public A (){   System.out.println("A");  } }  class B extends A{  public B(){  System.out.println("B"); }  public static void main(String[] args){    B b=new B();  } }  上述程序将()。 

    • A、不能通过编译
    • B、通过编译,输出为:A B
    • C、通过编译,输出为:B
    • D、通过编译,输出为:A

    正确答案:B

  • 第8题:

    Public class test (  Public static void main (String args[])  (  System.out.printIn (6 ^ 3);  )  )   What is the output?()


    正确答案:5

  • 第9题:

    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 elm
    • B、tree elm elm elm
    • C、tree elm tree elm
    • D、编译失败

    正确答案:D

  • 第10题:

    填空题
    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?()

    正确答案: JAVAJAVA
    解析: 暂无解析

  • 第11题:

    单选题
    执行以下代码后,下面哪些描述是正确的() public  class  Student{  private String name = “Jema”;  public void setName(String name){  this.name = name;  }  public String getName(){  return this.name;  }  public static void main(String[] args){  Student s;  System.out.println(s.getName()); } }
    A

    输出null

    B

    第10行编译报错

    C

    第11行编译报错

    D

    输出Jema


    正确答案: D
    解析: 暂无解析

  • 第12题:

    单选题
    给定如下Java程序片断:  class A{  public A (){   System.out.println("A");  } }  class B extends A{  public B(){  System.out.println("B"); }  public static void main(String[] args){    B b=new B();  } }  上述程序将()。
    A

    不能通过编译

    B

    通过编译,输出为:A B

    C

    通过编译,输出为:B

    D

    通过编译,输出为:A


    正确答案: B
    解析: 暂无解析

  • 第13题:

    以下程序的调试结果为?

    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.输出结果 Outer

    B.输出结果 Inner

    C.编译错误,因Inner类定义为私有访问

    D.在创建Inner类实例的行出现编译错误


    正确答案:D

  • 第14题:

    以下语句能顺利通过编译: abstract class class1 { } public class mainClass { public static void main(String args[]) { class1 cs1=new class1(); } } 。()

    此题为判断题(对,错)。


    答案:错

  • 第15题:

    以下语句能顺利通过编译: class test { static void sayHello() { this.toString(); } public String toString() { retur。()

    此题为判断题(对,错)。


    答案:错


  • 第16题:

    以下语句能顺利通过编译: class class1 { private final void method1() {} }。()

    此题为判断题(对,错)。


    答案:对

  • 第17题:

    以下语句能顺利通过编译: class class1 { private final method1() {} } 。()

    此题为判断题(对,错)。


    答案:错

  • 第18题:

    执行以下代码后,下面哪些描述是正确的() public  class  Student{  private String name = “Jema”;  public void setName(String name){  this.name = name;  }  public String getName(){  return this.name;  }  public static void main(String[] args){  Student s;  System.out.println(s.getName()); } }

    • A、输出null
    • B、第10行编译报错
    • C、第11行编译报错
    • D、输出Jema

    正确答案:C

  • 第19题:

    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[])

    正确答案:D,E

  • 第20题:

    class Mineral {   static String shiny() { return "1"; }   }   class Granite extends Mineral {   public static void main(String [] args) {   String s = shiny() + getShiny();   s = s + super.shiny();   System.out.println(s);   }   static String getShiny() { return shiny(); }   }   结果为:()  

    • A、3
    • B、12
    • C、111
    • D、编译失败

    正确答案:D

  • 第21题:

    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?()


    正确答案:javajavaC

  • 第22题:

    多选题
    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[])


    正确答案: C,E
    解析: 暂无解析

  • 第23题:

    单选题
    class Mineral {   static String shiny() { return "1"; }   }   class Granite extends Mineral {   public static void main(String [] args) {   String s = shiny() + getShiny();   s = s + super.shiny();   System.out.println(s);   }   static String getShiny() { return shiny(); }   }   结果为:()
    A

    3

    B

    12

    C

    111

    D

    编译失败


    正确答案: D
    解析: 暂无解析