网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
class Foo { public static void main(String [] args) { int x = 0; int y = 4; for(int z=0; z 〈 3; z++, x++) { if(x 〉 1 & ++y 〈 10) y++; } System.out.println(y); } } 结果是什么?()
A
6
B
7
C
8
D
10
参考答案
参考解析
解析:
暂无解析
更多 “单选题class Foo { public static void main(String [] args) { int x = 0; int y = 4; for(int z=0; z 〈 3; z++, x++) { if(x 〉 1 ++y 〈 10) y++; } System.out.println(y); } } 结果是什么?()A 6B 7C 8D 10” 相关考题
考题
以下Java应用程序执行入口main方法的声明中,正确的是( )。
A.public static void main()B.public static void main(String[] args)C.public static int main(String[] args)D.public void main(String[] args)
考题
interface A{int x = 0;}class B{int x =1;}class C extends B implements A {public void pX(){System.out.println(x);}public static void main(String[] args) {new C().pX();}}
考题
main方法是Java Application程序执行的入口点,关于main方法头以下( )是合法的。A.public static void main( )B.public static void main (String[ ]args)C.public static int main (String[ ]arg)D.public void main(String arg[])
考题
以下是JAVA中正确的入口方法是? () A、 public static void main(String[] args){}B、 public static void main(String args){}C、 public void main(String[] args){}D、 public static int main(String[] args){}
考题
public class test( public static void main(string[]args){ string foo = args [1]; string foo = args [2]; string foo = args [3]; } ) And command line invocation: Java Test red green blue What is the result?() A、 Baz has the value of “”B、 Baz has the value of nullC、 Baz has the value of “red”D、 Baz has the value of “blue”E、 Bax has the value of “green”F、 The program throws an exception.
考题
public class Test { public static void main (String args) { string foo = “blue”; string bar = foo; foo = “green”; System.out.printIn(bar); } } What is the result?() A、 An exception is thrown.B、 The code will not compile.C、 The program prints “null”D、 The program prints “blue”E、 The program prints “green”
考题
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[])
考题
public class Base { public static final String FOO = “foo”; public static void main(String[] args) { Base b = new Base(); Sub s = new Sub(); System.out.print(Base.FOO); System.out.print(Sub.FOO); System.out.print(b.FOO); System.out.print(s.FOO); System.out.print(((Base)s).FOO); } } class Sub extends Base {public static final String FOO=bar;} What is the result?() A、 foofoofoofoofooB、 foobarfoobarbarC、 foobarfoofoofooD、 foobarfoobarfooE、 barbarbarbarbarF、 foofoofoobarbarG、 foofoofoobarfoo
考题
public class Foo { public static void main (String args) { int i = 1; int j = i++; if ((i++j) (i++ ==j)) { i +=j; } } } What is the final value of i?() A、 1B、 2C、 3D、 4E、 5
考题
下列有关main()方法的签名正确的是哪些?()A、 public static void main(String[] args){}B、 public static void main(){}C、 public static void main(String args[]){}D、 public void static main(String[] args){}
考题
下面哪些选项是正确的main方法说明?()A、 public main(String args[])B、 public static void main(String args[])C、 private static void main(String args[])D、 void main()
考题
作为Java应用程序入口的main方法,其声明格式可以是()。A、public static void main(String[] args)B、public static int main(String[] args)C、public void main(String[] args)D、public int main(String[] args)
考题
main方法是Java应用程序执行的入口点,关于main方法的方法头以下哪项是合法的?()A、public static void main()B、public static void main(String[]args)C、public static int main(String[]arg)D、public void main(Stringarg[])
考题
main方法是Java程序执行的入口点,关于main方法的方法头以下哪项是合法的()?A、public static void main( )B、public static void main( String args[] )C、public static int main(String [] arg )D、public void main(String arg[] )
考题
声明Java独立应用程序main()方法时,正确表达是()。A、public static void main(String[]args){…}B、private static void main(String args[]){…}C、public void main(String args[]){…}D、public static void main(){…}
考题
public class Foo { static int[] a; static { a[0]=2; } public static void main( String[] args) {} } Which exception or error will be thrown when a programmer attempts to run this code?() A、 java.lang. StackOverflowErrorB、 java.lang.IllegalStateExceptionC、 java.lang.ExceptionlnlnitializerErrorD、 java.lang.ArraylndexOutOfBoundsException
考题
public class Test { public static void main(String args[]) { class Foo { public int i = 3; } Object o = (Object)new Foo(); Foo foo = (Foo)o; System.out.println(“i = “ + foo.i); } } What is the result?() A、 i = 3B、 Compilation fails.C、 A ClassCastException is thrown at line 6.D、 A ClassCastException is thrown at line 7.
考题
public class test( public static void main(stringargs){ string foo = args [1]; string foo = args ; string foo = args ; } ) And command line invocation: Java Test red green blue What is the result? () A、 Baz has the value of “”B、 Baz has the value of nullC、 Baz has the value of “red”D、 Baz has the value of “blue”E、 Bax has the value of “green”F、 The program throws an exception.
考题
下面哪些main方法可用于程序执行()A、public static void main(String[]args)B、public static void main(String[]x)C、public static void main(Stringargs[])D、public void main(String[]args)
考题
单选题public class test( public static void main(string[]args){ string foo = args [1]; string foo = args [2]; string foo = args [3]; } ) And command line invocation: Java Test red green blue What is the result?()A
Baz has the value of “”B
Baz has the value of nullC
Baz has the value of “red”D
Baz has the value of “blue”E
Bax has the value of “green”F
The program throws an exception.
考题
多选题Which declarations will allow a class to be started as a standalone program?()Apublic void main(String args[])Bpublic void static main(String args[])Cpublic static main(String[] argv)Dfinal public static void main(String [] array)Epublic static void main(String args[])
考题
单选题public class Test { public static void main (String args) { class Foo { public int i = 3; } Object o = (Object) new Foo(); Foo foo = (Foo)o; System.out.printIn(foo. i); } } What is the result?()A
Compilation will fail.B
Compilation will succeed and the program will print “3”C
Compilation will succeed but the program will throw a ClassCastException at line 6.D
Compilation will succeed but the program will throw a ClassCastException at line 7.
考题
单选题public class Test { public static void main(String args[]) { class Foo { public int i = 3; } Object o = (Object)new Foo(); Foo foo = (Foo)o; System.out.println(“i = “ + foo.i); } } What is the result?()A
i = 3B
Compilation fails.C
A ClassCastException is thrown at line 6.D
A ClassCastException is thrown at line 7.
考题
多选题public class Foo { private int val; public foo(int v) (val = v;) } public static void main (String args) { Foo a = new Foo (10); Foo b = new Foo (10); Foo c = a; int d = 10; double e = 10.0; } Which three logical expression evaluate to true? ()A(a ==c)B(d ==e)C(b ==d)D(a ==b)E(b ==c)F(d ==10.0)
考题
单选题以下是JAVA中正确的入口方法是? ()A
public static void main(String[] args){}B
public static void main(String args){}C
public void main(String[] args){}D
public static int main(String[] args){}
考题
单选题public class Foo { public static void main (String []args) { int i = 1; int j = i++; if ((i++j) (i++ ==j)) { i +=j; } } } What is the final value of i?()A
1B
2C
3D
4E
5
考题
单选题public class Foo { static int[] a; static { a[0]=2; } public static void main( String[] args) {} } Which exception or error will be thrown when a programmer attempts to run this code?()A
java.lang. StackOverflowErrorB
java.lang.IllegalStateExceptionC
java.lang.ExceptionlnlnitializerErrorD
java.lang.ArraylndexOutOfBoundsException
热门标签
最新试卷