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? ()
第1题:
下列关于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.
第2题:
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
第3题:
2下列程序实现对ZIP 文件file.zip 的检索,在横线处填入正确的语句是( )。package test;import java.io.*;import java.util.*; import java.util.zip.*;public class Exam{ public static void main(String[] args){ try{ FileInputStream fis = new FilelnputStream("test/file.zip"); ZipInputStream zis = new ZiplnputStream(fis); ZipEntry en; while ((______ )!= null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e){ e.pfintStackTrace(); }}
A.en = zis. getNextEntry()
B.en == zis.getNextEntry(
C.en=zis. getEntry()
D.zis.getNextEntry()
第4题:
A.any class
B.only the Target class
C.any class in the test package
D.any class that extends Target
第5题:
下列程序的运行结果是【 】。
include <iostream. h>
class test
{
private:
int num;
public:
test()
int TEST() {return num+100;}
~test()
};
test::test(){num=0;}
test::~test(){cout<<"Destructor is active"<<endl;}
void main()
{
test x[3]
cout<<x[1]. TEST()<<endl;
}
第6题:
有如下程序:#include<iostream>using namespace std;class test{private: int a;public: test(){cout<<"constructor"<<endl;} test(int a){cout<<a<<endl;} test(const test&_test) { a=_test.a; cout<<"copy constructor"<<en+dl; } ~test(){cout<<"destructor"<<endl;}};int main(){ test A(3); rerun 0;}运行时输出的结果是
A.3
B.constructor destructor
C.copy constructor destructor
D.3 destructor
第7题:
下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static void.main(String args[]) { Test test=new Test(); test.aMethod(); }
A.编译错误
B.0
C.1
D.运行成功,但不输出
第8题:
有如下程序: #include<iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;} static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;
A.n=0
B.n=1
C.n=2
D.n=3
第9题:
A.5
B.10
C.12
D.17
E.24
第10题:
下列哪个选项的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{ }