-
public class SomeException { } Class a: public class a { public void doSomething() { } } Class b: public class b extends a { public void doSomething() throws SomeException { } } Which is true about the two classes?()
A . Compilation of both classes will fail.
B . Compilation of both classes will succeed.
C . Compilation of class a will fail. Compilation of class b will succeed.
D . Compilation of class a will fail. Compilation of class a will succeed.
-
package geometry; public class Hypotenuse { public InnerTriangle it = new InnerTriangle(); class InnerTriangle { public int base; public int height; } } Which is true about the class of an object that can reference the variable base? ()
A . It can be any class.
B . No class has access to base.
C . The class must belong to the geometry package.
D . The class must be a subclass of the class Hypotenuse.
-
Given:10. interface Data { public void load(); }11. abstract class Info { public abstract void load(); }Which class correctly uses the Data interface and Info class?()()
A .https://assets.asklib.com/images/image2/2018080210481836686.jpg
B .https://assets.asklib.com/images/image2/2018080210482719010.jpg
C .https://assets.asklib.com/images/image2/2018080210483486806.jpg
D .https://assets.asklib.com/images/image2/2018080210483925433.jpg
E .https://assets.asklib.com/images/image2/2018080210484613654.jpg
F .https://assets.asklib.com/images/image2/2018080210485087701.jpg
-
public class Plant { private String name; public Plant(String name) { this.name = name; } public String getName() { return name; } } public class Tree extends Plant { public void growFruit() { } public void dropLeaves() { } } Which is true?()
A . The code will compile without changes.
B . The code will compile if public Tree() { Plant(); } is added to the Tree class.
C . The code will compile if public Plant() { Tree(); } is added to the Plant class.
D . The code will compile if public Plant() { this(”fern”); } is added to the Plant class.
E . The code will compile if public Plant() { Plant(”fern”); } is added to the Plant class.
-
public class Parent{ public void change(int x){} } public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?()
A . protected void change(int x){}
B . public void change(int x, int y){}
C . public void change(String s){}
D . public void change(int x){}
-
Given: 10.interface Data { public void load(); } 11.abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()
A .https://assets.asklib.com/images/image2/2018080114295971472.png
B .https://assets.asklib.com/images/image2/2018080114300659438.png
C .https://assets.asklib.com/images/image2/2018080114301390095.png
D .https://assets.asklib.com/images/image2/2018080114301865887.png
-
package foo; public class Outer { public static class Inner { } } Which statement is true?()
A . Compilation fails.
B . An instance of the Inner class can be constructed with “new Outer.Inner()”.
C . An instance of the Inner class cannot be constructed outside of package foo.
D . An instance of the Inner class can be constructed only from within the Outer class.
E . From within the package foo, and instance of the Inner class can be constructed with “new Inner()”.
-
package foo; public class Outer ( public static class Inner ( ) ) Which statement is true?()
A . An instance of the Inner class can be constructed with “new Outer.Inner()”
B . An instance of the inner class cannot be constructed outside of package foo.
C . An instance of the inner class can only be constructed from within the outer class.
D . From within the package bar, an instance of the inner class can be constructed with “new inner()&rdquo
-
interface Data { public void load(); } abstract class Info { public abstract void load(); } Which class correctly uses the Data interface and Info class?()
A . public class Employee extends Info implements Data { public void load() { /*do something*/ } }
B . public class Employee implements Info extends Data { public void load() { /*do something*/ } }
C . public class Employee extends Info implements Data { public void load() { /*do something */ } public void Info.load() { /*do something*/ } }
D . public class Employee implements Info extends Data { public void Data.load() { /*dsomething */ } public void load() { /*do something */ } }
E . public class Employee implements Info extends Data { public void load() { /*do something */ } public void Info.load(){ /*do something*/ } }
F . public class Employee extends Info implements Data{ public void Data.load() { /*do something*/ } public void Info.load() { /*do something*/ } }
-
public class Parent{ public void change(int x){} } public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?()
A . protected void change(int x){}
B . public void change(int x, int y){}
C . public void change(String s){}
D . public void change(int x){}
-
public class X { public X aMethod() { return this;} } public class Y extends X { } Which two methods can be added to the definition of class Y?()
A . public void aMethod() {}
B . private void aMethod() {}
C . public void aMethod(String s) {}
D . private Y aMethod() { return null; }
E . public X aMethod() { return new Y(); }
-
现有 public class Parentt public void change (int x){) ) public class Child extends Parent{ //覆盖父类change方法 } 下列哪个声明是正确的覆盖了父类的change方法?()
A . protected void change (int x){}
B . public void change(int x, int y){}
C . public void change (int x){}
D . public void change (String s){}
-
已知:class A{public:int a;int b();int f();int f(int);int g();};class B{public:char f();int g();private:int a;int b();};class C:public A,public B{};设有:C *pc;则:
-
已知定义public class Employee public class Manager extends Employee public class Contr已知定义public class Employee public class Manager extends Employee public class Contractor extends Employee Employee e=new Employee()
A.true
B.false
C.不一定
D.10
-
对于类定义:class A{public:virtual void func1(){}void func2(){}};class B:public A{public:
对于类定义: class A{ public: virtual void func1(){} void func2(){} }; class B:public A{ public: void func1(){cout<<"class B func 1"<<end1;} virtual void func2(){cout<<"class B func 2"<<end1;} }; 下面叙述正确的是(53)。
A.A∷func2()和B∷func1()都是虚函数
B.A∷func2()和B∷func1()都不是虚函数
C.B∷func1()是虚函数,而A∷func2()不是虚函数
D.B∷func1()不是虚函数,而A∷func2()是虚函数
-
下面程序段的输出结果为package test;public class Class A{ int x=20; static int y=6; public
下面程序段的输出结果为 package test; public class Class A { int x=20; static int y=6; public static void main(String args[]) { Class B b=new Class B(); b.go(10); System.out.println("x"+b.x); } } class ClassB { int x; void go(int y) { ClassA a=new ClassA(); x=a.y; } }
A.x=10
B.x-20
C.x=6
D.编译不通过
-
14、关于以下C代码的说法正确的是 public abstract class Animal { public abstract void Eat(); } public class Tiger : Animal { public override void Eat() { Console.WriteLine("老虎吃..."); } } public class Tigress : Tiger { static void Main() { Tigress tiger = new Tigress(); tiger.Eat(); } }
A.代码正确,但没有输出
B.代码正确,并且输出为"老虎吃...”
C.代码错误,因为Tigress类没有实现抽象基类Animal中的抽象方法
D.代码错误,因为抽象基类Animal的Eat方法没有实现
-
代码三: public class Test03 { public static void main(); } }
-
以下程序的执行结果是()class Guy {public Guy(){System.out.print(“111,”);}}class Cowboy extends Guy {public Cowboy(){System.out.print(“222,”);}}class Wrangler extends Cowbo
A.111,111,222,111,222,333
B.111,222,333
C.111,111,222,222,333
D.编译不通过
-
某 Java源文件代码如下: public class A { int a; } class B { int b; } class C { public static void main()
A.java A
B.java B
C.java C
D.javA.class
-
3、下面程序段中,说法正确的是() class location{ public : int GetX(); }; class rectangle:private location { public: int GetW(); };
A.类rectangle的私有派生类是location
B.类rectangle中的public成员在类 location中是私有的
C.类location中的public成员在类 rectangle中是不可访问的
D.viod f() { Rectangle r; int X=r .GetX(); } 其中int X = r .GetX();是非法语句
-
public class Example { public static void main()
A.catch语句块执行
B.catch语句块执行 程序继续向下执行
C.语句块执行 finally语句块执行
D.程序继续向下执行
-
public class Something {public static void main() { o.i++ } } class Other { public int i } 和上面的很相似,都是关于final 的问题,这有错吗?
-
public class ZuoYe3_2{ public static void main(); } }