此题为判断题(对,错)。
第1题:
A. hello
B. hello2
C. 编译报错
D. 运行报错,不能将串与整数相加
第2题:
此题为判断题(对,错)。
第3题:
此题为判断题(对,错)。
第4题:
此题为判断题(对,错)。
第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题:
此题为判断题(对,错)。
第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(); } } 上述程序将()。
第8题:
Public class test ( Public static void main (String args[]) ( System.out.printIn (6 ^ 3); ) ) What is the output?()
第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); } } 结果为:()
第10题:
第11题:
输出null
第10行编译报错
第11行编译报错
输出Jema
第12题:
不能通过编译
通过编译,输出为:A B
通过编译,输出为:B
通过编译,输出为:A
第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类实例的行出现编译错误
第14题:
此题为判断题(对,错)。
第15题:
此题为判断题(对,错)。
第16题:
此题为判断题(对,错)。
第17题:
此题为判断题(对,错)。
第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()); } }
第19题:
Which declarations will allow a class to be started as a standalone program?()
第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(); } } 结果为:()
第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?()
第22题:
public void main(String args[])
public void static main(String args[])
public static main(String[] argv)
final public static void main(String [] array)
public static void main(String args[])
第23题:
3
12
111
编译失败