网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
以下代码运行后输出的内容()class AAA{ abstract public void funX(); public void funY() {System.out.println("funY");} } public class Main { public static void main(String[] args) { AAA a = new AAA(); a.funY(); } }
A.funY
B.无输出
C.funX
D.程序错误,无法运行
参考答案和解析
程序错误,无法运行
更多 “以下代码运行后输出的内容()class AAA{ abstract public void funX(); public void funY() {System.out.println("funY");} } public class Main { public static void main(String[] args) { AAA a = new AAA(); a.funY(); } }A.funYB.无输出C.funXD.程序错误,无法运行” 相关考题
考题
下列代码的运行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(89>>1); } }A.44B.45C.88D.90
考题
阅读下列代码段,选出该代码段的正确文件名( )。 class A { void methodl() { System.out.println("methodl in class A"); } } public class B { void method2() { System.out.println("method2 in class B"); } public static void main(String args[]) { System.out.println("main in class B"); } }A.A.javaB.A.classC.B.classD.B.java
考题
阅读下列代码段,选出该代码段的正确文件名( )。 class A { void method1() { System.out.println("method1 in class A"); } } public class B { void method2() { System.out.println("method2 in class B"); } public static void main(String args[]) { System.out.println("main in class B"); } }A.A.javaB.A.classC.B.classD.B.java
考题
请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”Class Test 【 15 】 {Public static void main (String[] arge){Test t = new Test();t.start();}Public void run(){System.out.println( “ Hello! ” );}
考题
阅读下面代码 public class { public static void main(String[] args) { double d=12.3; Decrementer dec=new Decrementer(); dec.decrement(d); System.out.println(d); } } class Decrementer { public void decrement(double decMe) { decMe=decMe-1.0; } } 代码执行后输出的结果是A.12.3B.11.3C.13.3D.-1.0
考题
阅读下列代码段,选出该代码段的正确的文件名( )。 class A { void method () { System.out.println ("methodl in class A"); } } public class B { void method2 () { System.out.println("method2 in class B"); } public static void main (String args[]) { System.out.println ("main () in class B"); } }A.A.javaB.A.classC.B.classD.B.java
考题
public class Something {public static void main(String[] args) {Something s = new Something();System.out.println("s.doSomething() returns " + doSomething());}public String doSomething() {return "Do something ...";}}看上去很完美。
考题
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();}}
考题
下列程序创建了一个线程并运行,横线处应填入的正确代码是( )。 public class Try extends Thread{ public static void main(String args[]){ Thread t=new Try; ; } public void runf System.out.println(”Try!"); } }A.t.startB.t.classC.t.threadD.t.static
考题
写出程序的输出结果public abstract class A{public A(){Console.WriteLine('A');}public virtual void Fun(){Console.WriteLine("A.Fun()");}}public class B: A{public B(){Console.WriteLine('B');}public new void Fun(){Console.WriteLine("B.Fun()");}public static void Main(){A a = new B();a.Fun();}}
考题
以下哪个是Java应用程序main方法的有效定义?
A. public static void main();B. public static void main( String args );C. public static void main( String args[] );D. public static void main( Graphics g );E. public static boolean main( String a[] );
考题
下列程序创建了一个线程并运行,请在下划线处填入正确代码。public class Try extends Thread{public static void main(String args[]){Threadt=new Try();【 】;}public void run(){System.out.println(“Try!”);}}
考题
以下语句能顺利通过编译: abstract class class1 { } public class mainClass { public static void main(String args[]) { class1 cs1=new class1(); } } 。()
此题为判断题(对,错)。
考题
执行以下代码,输出结果的结果是? () public class Test{ public String[] ss = new String[5]; public static void main(String[] args){ System.out.println(ss[1]); } } A、 nullB、 -1C、 编译时出错D、 运行时报错
考题
以下是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){}
考题
class MyThread extends Thread { public void run() { System.out.println(“AAA”); } public void run(Runnable r) { System.out.println(“BBB”); } public static void main(String[] args) { new Thread(new MyThread()).start(); } } What is the result?() A、 AAAB、 BBBC、 Compilation fails.D、 The code runs with no output.
考题
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 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?()
考题
下列有关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){}
考题
class TestA { public void start() { System.out.println(”TestA”); } } public class TestB extends TestA { public void start() { System.out.println(”TestB”); } public static void main(String[] args) { ((TestA)new TestB()).start(); } } What is the result?() A、 TestAB、 TestBC、 Compilation fails.D、 An exception is thrown at runtime.
考题
现有: class TestA { public void start() { System.out.println("TestA"); } } public class TestB extends TestA { public void start() { System.out.println("TestB"); } public static void main (string[] args) ( ((TestA)new TestB()).start(); ) } 运行结果是哪项?() A、 TeStAB、 TeStBC、编译失败D、运行时抛出异常
考题
下面哪些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)
考题
单选题以下是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){}
考题
单选题现有: class TestA { public void start() { System.out.println("TestA"); } } public class TestB extends TestA { public void start() { System.out.println("TestB"); } public static void main (string[] args) ( ((TestA)new TestB()).start(); ) } 运行结果是哪项?()A
TeStAB
TeStBC
编译失败D
运行时抛出异常
考题
单选题class TestA { public void start() { System.out.println(”TestA”); } } public class TestB extends TestA { public void start() { System.out.println(”TestB”); } public static void main(String[] args) { ((TestA)new TestB()).start(); } } What is the result?()A
TestAB
TestBC
Compilation fails.D
An exception is thrown at runtime.
考题
填空题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?()
考题
单选题class MyThread extends Thread { public void run() { System.out.println(“AAA”); } public void run(Runnable r) { System.out.println(“BBB”); } public static void main(String[] args) { new Thread(new MyThread()).start(); } } What is the result?()A
AAAB
BBBC
Compilation fails.D
The code runs with no output.
考题
单选题执行以下代码,输出结果的结果是? () public class Test{ public String[] ss = new String[5]; public static void main(String[] args){ System.out.println(ss[1]); } }A
nullB
-1C
编译时出错D
运行时报错
热门标签
最新试卷