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?()
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? ()
public class Pass{ public static void main(String[]args){ int x=5; Pass p=new Pass(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()
1. public class Person { 2. private String name; 3. public Person(String name) { this.name = name; } 4. public boolean equals(Person p) { 5. return p.name.equals(this.name); 6. } 7. } Which is true?()
public class Pass { public static void main(String [1 args) { int x 5; Pass p = new Pass(); p.doStuff(x); System.out.print(” main x = “+ x); } void doStuff(int x) { System.out.print(” doStuff x = “+ x++); } } What is the result?()
package foo; public class Outer { public static class Inner { } } Which statement is true?()
package foo; public class Outer ( public static class Inner ( ) ) Which statement is true?()
现有: public class Pet() public class Cat extends Pet{) 执行代码 Cat c- new Cat(); Pet p= (Pet)c; 后下列哪项是正确的?()
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?()
现有: public class Pet() public class Cat extends Pet{) 执行代码 Cat c- new Cat(); Pet p= (Pet)c; 后下列哪项是正确的?()
public class Team extends java.util.LinkedList { public void addPlayer(Player p) { add(p); } public void compete(Team opponent) { /* more code here */ } } class Player { /* more code here */ } Which two are true?()
Given the command line java Pass2 and: public class Pass2{ public void main(String[]args){ int x=6; Pass2 p=new Pass2(); p.doStuff(x); System.out.print("mainx="+x); } void doStuff(intx){ System.out.print("doStuffx="+x++); } } What is the result?()
给定JAVA代码,如下:Class Parent{public void count() {System.out.println(10%3) ;}}public class Test extends Parent{public void count() {System.out.println(10/3) ;}public static void main(Stringargs[]) {Parent p = new Test() ;p.count() ;}}运行编译后,输出结果是()。
类MyClass的定义如下:class MyClass{ public:MyClass(){ value = 0;}SetVariable(inti) { value = i; }private:int value;}则对下列语句序列:MyClass*p,my; p=&my;正确的描述是( )。
运行下面程序时,会产生什么异常?( )public class X7_1_4 {public static void main(String[] args) {int x = 0;int y = 5/x;int[] z = {1,2,3,4};int p = z[4];}}ArithmeticException |NumberFormatException|ArrayIndexOutOfBoundsException |IOException
请看如下代码 class Person {private int a;public int change(int m){return m;}}public class Teacher extends Person{public int b;public static void main(String arg[]){Person p = new Person();Teacher t = new Teacher();int i;// point x}}下面哪些放在// point x?行是正确的?
下面程序输出的结果为()。 inClUde”iostream.h” Class A {public: A(){cout<<“CLASS A”<<endl;} ~A()<)}; class B:public A {public: B(){cout<<”CLASSB”<<endl;} ~B(){}}; void main() {A*p; p=new B; B *q; q=new B;}
运行下面程序时,会产生什么异常?() public class X7_1_5 { public static void main(String[] args) { int[] z = {1,2,3,4}; int p = z[4]; int x = 0; int y = p/x; } }
已知定义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()
有如下程序:include<iostream>using namespace std;class A {public:A(){cout<<"A";}};classB{p
对于类定义:class A{public:virtual void func1(){}void func2(){}};class B:public A{public:
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(); } }
某 Java源文件代码如下: public class A { int a; } class B { int b; } class C { public static void main()
3、阅读下面代码,写出输出结果: public class A { public void fun1(int n) { Console.WriteLine("{0}x2={1}", n, 2 * n); } public void fun2(int n) { Console.WriteLine("{0}x3={1}", n, 3 * n); } } public delegate void mydelegate(int n) public class Test { public static event mydelegate p; static void Main() { A a = new A(); p += new mydelegate(a.fun1); p(1); } }