Compilation will fail.
Compilation will succeed and the program will print “3”
Compilation will succeed but the program will throw a ClassCastException at line 6.
Compilation will succeed but the program will throw a ClassCastException at line 7.
第1题:
已知有下列类的说明,则下列哪个语句是正确的?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.f;
B.this. n
C.Test.m;
D.Test.f;
第2题:
下列程序的输出结果是 class Test{ public static void main(String args[]){ int n=7; n<<=3; n=n&n+1|n+2^n+3; n>>=2; System.out.println(n); } }
A.0
B.-1
C.14
D.64
第3题:
下列程序的运行结果是【 】。
public class Test {
public static void main (String args[]) {
String s1="hello!";
System.out.println (s1.toUpperCase());
}}
第4题:
Which declarations will allow a class to be started as a standalone program?()
第5题:
main方法是JavaApplication程序执行的入口点。关于main方法的方法头,下列合法的是( )。
A.public static void main()
B. public static void main(String[])args)
C. public static iht main(String[]arg)
D.public void main(String arg[])
第6题:
下列程序的输出结果是public class fff { void printValue (int m) { do { System.out.println("The value is" +m); } while(--m>10) } public static void main (String arg[]) { int i=10; Test t= new Test(); t. printValue(i); }}
A.8
B.9
C.10
D.11
第7题:
main方法是Java Application程序执行的入口点,关于main方法头以下( )是合法的。
A.pubUc statk void main()
B.public static void main (String[]args)
C.public static int main (String[]arg)
D.public void main (String arg[])
第8题:
A.t.f
B.this.n
C.Test.m
D.Test.n
第9题:
执行以下代码会输出什么结果?() public class Test { StringgetStr(String s){ return s + “hello”; } public static void main(String arg[]) { Test t= new Test(); System.out.println(t.getStr(“LiLei/n”)); } }
第10题:
Public class test ( Public static void main (String args[]) ( System.out.printIn (6 ^ 3); ) ) What is the output?()