网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
单选题
public class Test {} What is the prototype of the default constructor?()
A
Test()
B
Test(void)
C
public Test()
D
public Test(void)
E
public void Test()
参考答案
参考解析
解析:
The correct answer to this question is C. The default constructor always takes the same access of the class. In this case, the class is public and so does the default constructor.
更多 “单选题public class Test {} What is the prototype of the default constructor?()A Test()B Test(void)C public Test()D public Test(void)E public void Test()” 相关考题
考题
下列关于Test类的定义中,正确的是______。A) class Test implements Runnabte{public void run(){}public void someMethod(){}B) class Test implements Rnuuable{public void run();}C) class Test implements Rnuuable{public void someMethod();}D) class Test implements Rnuuable{public void someMethod();{}}A.B.C.D.
考题
在如下源代码文件Test.java中, 哪个是正确的类定义?()
A.public class test { public int x = 0; public test(int x) { this.x = x; } }B.public class Test{ public int x=0; public Test(int x) { this.x = x; } }C.public class Test extends T1, T2 { public int x = 0; public Test (int x) { this.x = x; } }D.public class
考题
public class Test{2.int x=12;3.public void method(intx){4.x+=x;5.System.out.println(x);6.}7.}Given:34.Test t=new Test();35.t.method(5);What is the output from line 5 of the Test class?()
A.5B.10C.12D.17E.24
考题
package test;class Target{public String name=hello;}What can directly access and change the value of the variable name?()
A.any classB.only the Target classC.any class in the test packageD.any class that extends Target
考题
下列哪个选项的java源文件代码片段是不正确的?A.package testpackage; public class Test{ }B.import java. io. *; package testpaekage; public class Test { }C.import java.io.*; class Person { } public class Test { }D.import java.io.*; import java. awt.*; public class Test{ }
考题
在下列源代码文件Test.java中,正确定义类的代码是( )。A.pblic class test { public int x=0; public test(int x) { this. x=x;} }B.public class Test { public int x=0; public Test(int x) { this. x=x;} }C.public class Test extends T1,T2{ public int x = 0; public Test(int x){ this. x = x; } }D.protected class Test extends T2{ public int x = 0; public Test(int x) { this. x = x; } }
考题
下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }
考题
下列关于Test类的定义中,正确的是( )。A.class Test implements Runnable{ public void run{} Dublic void someMethod[]{} }B.class Test implements Runnable( puIblic void run; }C.class Test implements Runnable( Dublic void someMethod[]; }D.class Test implements Runnable( public void someMethod{} }
考题
在下列源代码文件Test.java中, ( )是正确的类定义。A.public class test{B.public class Test{ public int x=0;public int x=0; public test (intx) public Test (int x){ {this.x=x; this.x=x;} }} }C.public class Test extends T1,T2{D.protected class Test extends T2{ public int=0;public int x=0; public Test(int x){Public Test (int x){ this.x=x;this.x=x: }} }}
考题
在下列源代码文件Test.java中,哪个选项是正确的类定义? ( )A.public class test { public int x=0; public test(int x) { this.x=x; } }B.public class Test { public int x=0; public Test(int x) { this.x=x; } }C.public class Test extends Ti,T2 { public int x=0; public Test(int x) { this.x=x; } }D.protected class Test extends T2 { public int x=0; public Test(int x) { this.x=x; } }
考题
package test1; public class Test1 { static int x = 42; } package test2; public class Test2 extends test1.Test1 { public static void main(String[] args) { System.out.println(“x = “ + x); } } What is the result?() A、 x = 0B、 x = 42C、 Compilation fails because of an error in line 2 of class Test2.D、 Compilation fails because of an error in line 3 of class Test1.E、 Compilation fails because of an error in line 4 of class Test2.
考题
Public class test ( Public static void main (String args[]) ( System.out.printIn (6 ^ 3); ) ) What is the output?()
考题
public class Test { public static void main(String Args[]) { int i =1, j = 0; switch(i) { case 2: j +=6; case 4: j +=1; default: j +=2; case 0: j +=4; } System.out.println(“j =” +j); } } What is the result? () A、 0B、 2C、 4D、 6E、 9F、 13
考题
public class Test { public enum Dogs {collie, harrier, shepherd}; public static void main(String [] args) { Dogs myDog = Dogs.shepherd; switch (myDog) { case collie: System.out.print(”collie “); case default: System.out.print(”retriever “); case harrier: System.out.print(”harrier “); } } } What is the result?() A、 harrierB、 shepherdC、 retrieverD、 Compilation fails.E、 retriever harrierF、 An exception is thrown at runtime.
考题
public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
考题
public class Test {} What is the prototype of the default constructor?() A、 Test()B、 Test(void)C、 public Test()D、 public Test(void)E、 public void Test()
考题
单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()A
any classB
only the Target classC
any class in the test packageD
any class that extends Target
考题
单选题public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?()A
0B
1C
2D
Compilation fails.
考题
单选题Given: 1.package test; 2. 3.class Target { 4.public String name = "hello";5.} What can directly access and change the value of the variable name?()A
any classB
only the Target classC
any class in the test packageD
any class that extends Target
考题
单选题public class Test { public enum Dogs {collie, harrier, shepherd}; public static void main(String [] args) { Dogs myDog = Dogs.shepherd; switch (myDog) { case collie: System.out.print(”collie “); case default: System.out.print(”retriever “); case harrier: System.out.print(”harrier “); } } } What is the result?()A
harrierB
shepherdC
retrieverD
Compilation fails.E
retriever harrierF
An exception is thrown at runtime.
考题
单选题package test1; public class Test1 { static int x = 42; } package test2; public class Test2 extends test1.Test1 { public static void main(String[] args) { System.out.println(“x = “ + x); } } What is the result?()A
x = 0B
x = 42C
Compilation fails because of an error in line 2 of class Test2.D
Compilation fails because of an error in line 3 of class Test1.E
Compilation fails because of an error in line 4 of class Test2.
考题
单选题package test; class Target{ public String name="hello"; } What can directly access and change the value of the variable name?()A
any classB
only the Target classC
any class in the test packageD
any class that extends Target
考题
填空题Public class test ( Public static void main (String args) ( System.out.printIn (6^3); ) ) What is the output? ()
考题
单选题public class test( public int aMethod()[ static int i=0; i++; return I; ) public static void main (String args){ test test = new test(); test.aMethod(); int j = test.aMethod(); System.out.printIn(j); ] } What is the result?()A
Compilation will fail.B
Compilation will succeed and the program will print “0”C
Compilation will succeed and the program will print “1”D
Compilation will succeed and the program will print “2”
考题
单选题1.public class Test{ 2.int x=12; 3.public void method(intx){ 4.x+=x; 5.System.out.println(x); 6.} 7.} Given: 34.Test t=new Test(); 35.t.method(5); What is the output from line 5 of the Test class?()A
5B
10C
12D
17E
24
考题
单选题public class Test { public static void main(String Args[]) { int i =1, j = 0; switch(i) { case 2: j +=6; case 4: j +=1; default: j +=2; case 0: j +=4; } System.out.println(“j =” +j); } } What is the result? ()A
0B
2C
4D
6E
9F
13
考题
单选题package test; class Target { public String name = “hello”; } What can directly access and change the value of the variable name?()A
any classB
only the Target classC
any class in the test packageD
any class that extends Target
热门标签
最新试卷