• 2021-04-14 问题

    (7-1)请阅读程序,并写出程序运行结果。 class X{ int getX() { return 5; } } class Y extends X{ int getX() { return 6; } } class T extends X{ int getX() { return 7; } } public class Demo10 { public static void main(String[] args) { X x=new X(); Y y=new Y(); X t=new T(); int sum=x.getX()+y.getX()+t.getX(); System.out.println(sum); } }

    (7-1)请阅读程序,并写出程序运行结果。 class X{ int getX() { return 5; } } class Y extends X{ int getX() { return 6; } } class T extends X{ int getX() { return 7; } } public class Demo10 { public static void main(String[] args) { X x=new X(); Y y=new Y(); X t=new T(); int sum=x.getX()+y.getX()+t.getX(); System.out.println(sum); } }

  • 2021-04-14 问题

    在JSP中,给定以下JSP代码片段,运行结果是()。 <% int x=5; %> <%! int x=7; %> <%! int getX(){ return x; } %> <% out.print(“X1=”+x); %> <% out.print(“X2=”+getX()); %>

    在JSP中,给定以下JSP代码片段,运行结果是()。 <% int x=5; %> <%! int x=7; %> <%! int getX(){ return x; } %> <% out.print(“X1=”+x); %> <% out.print(“X2=”+getX()); %>

  • 2022-07-22 问题

    以下的类(接口)定义中正确的是( ) A: public class A{ private int x; public getX(){ return x; }} B: public abstract class A{ private int x; public abstract int getX(); public int aMethod(){ return 0; }} C: public class A{ private int x; public abstract int getX();} D: public interface interfaceA{ private int x; public int getX(){ return x; }}

    以下的类(接口)定义中正确的是( ) A: public class A{ private int x; public getX(){ return x; }} B: public abstract class A{ private int x; public abstract int getX(); public int aMethod(){ return 0; }} C: public class A{ private int x; public abstract int getX();} D: public interface interfaceA{ private int x; public int getX(){ return x; }}

  • 2022-07-29 问题

    有如下程序: #include<iostream> using namespace std; class XX{ int x; public: XX(int XX=0):x(xx){} int getX(){return x;} }; class YY:public XX{ int y; public: YY(int xx,int yy):XX(xx),y(yy){} int getV(){return getX()+y;} }; int main(){ YY c(3,4); cout<<c.getV()+c.getX()<<endl; return 0; } 运行这个程序的输出结果是______。 A: 3 B: 4 C: 7 D: 10

    有如下程序: #include<iostream> using namespace std; class XX{ int x; public: XX(int XX=0):x(xx){} int getX(){return x;} }; class YY:public XX{ int y; public: YY(int xx,int yy):XX(xx),y(yy){} int getV(){return getX()+y;} }; int main(){ YY c(3,4); cout<<c.getV()+c.getX()<<endl; return 0; } 运行这个程序的输出结果是______。 A: 3 B: 4 C: 7 D: 10

  • 2021-04-14 问题

    (7-1)以下程序运行结果是()。 class FatherX{ public Integer getX() { return new Integer(10); } } class Son extends FatherX{ public Double getX() { return new Double(20); } } public class Demo12 { public static void main(String[] args) { FatherX f=new FatherX(); Son s=new Son(); System.out.println(f.getX()+s.getX()); } }

    (7-1)以下程序运行结果是()。 class FatherX{ public Integer getX() { return new Integer(10); } } class Son extends FatherX{ public Double getX() { return new Double(20); } } public class Demo12 { public static void main(String[] args) { FatherX f=new FatherX(); Son s=new Son(); System.out.println(f.getX()+s.getX()); } }

  • 2022-05-28 问题

    有以下定义: class A{ public: A(int vx){ x=vx; } void f(int vx) {x=vx; } int getx() {return x; } private: int x; }; 要为类型A设计类外的一个无返回值的函数fun,用于接收一个A类型的对象,如 int main() { A obj(3); fun(obj); return 0; } 先要求约束fun不能对obj的值做修改,那么下列可行的办法是

    有以下定义: class A{ public: A(int vx){ x=vx; } void f(int vx) {x=vx; } int getx() {return x; } private: int x; }; 要为类型A设计类外的一个无返回值的函数fun,用于接收一个A类型的对象,如 int main() { A obj(3); fun(obj); return 0; } 先要求约束fun不能对obj的值做修改,那么下列可行的办法是

  • 2021-04-14 问题

    (7-12)请阅读程序,写出程序运行结果。 class A{ static String name="tom"; static int getX() { return 2; } int getY() { return 3; } } class B extends A{ static String name="Tuny"; static int getX() { return 4; } int getY() { return 5; } } class C extends A{ static String name="Tuny"; static int getX() { return 4; } int getY() { return 5; } } interface D{ int getY(); } class E implements D{ public int getY() { return 6; } } public class Demo{ public static void main(String[] args) { A a=new A(); A b=new B(); A c=new C(); D d=new E(); int sum=a.name.length()+b.getX()+c.getY()+d.getY(); System.out.println(sum); } }

    (7-12)请阅读程序,写出程序运行结果。 class A{ static String name="tom"; static int getX() { return 2; } int getY() { return 3; } } class B extends A{ static String name="Tuny"; static int getX() { return 4; } int getY() { return 5; } } class C extends A{ static String name="Tuny"; static int getX() { return 4; } int getY() { return 5; } } interface D{ int getY(); } class E implements D{ public int getY() { return 6; } } public class Demo{ public static void main(String[] args) { A a=new A(); A b=new B(); A c=new C(); D d=new E(); int sum=a.name.length()+b.getX()+c.getY()+d.getY(); System.out.println(sum); } }

  • 2022-06-30 问题

    下列变量组()是一个闭回路。 A: {x,x,x,x,x,x} B: {x,x,x,x,x} C: {x,x,x,x,x,x} D: {x,x,x,x,x,x}

    下列变量组()是一个闭回路。 A: {x,x,x,x,x,x} B: {x,x,x,x,x} C: {x,x,x,x,x,x} D: {x,x,x,x,x,x}

  • 2021-04-14 问题

    以下谓词蕴含式正确的是(): (∀x) (A(x)→B(x))=>( ∀x)A(x)→(∀x)B(x)|(∀x) (A(x)↔B(x))=>( ∀x)A(x)↔(∀x)B(x)|(∀x)A(x)∨(∀x)B(x)=>( ∀x) (A(x)∨B(x))|(∃x) (A(x)∧B(x))=>(∃x)A(x)∧(∃x)B(x)

    以下谓词蕴含式正确的是(): (∀x) (A(x)→B(x))=>( ∀x)A(x)→(∀x)B(x)|(∀x) (A(x)↔B(x))=>( ∀x)A(x)↔(∀x)B(x)|(∀x)A(x)∨(∀x)B(x)=>( ∀x) (A(x)∨B(x))|(∃x) (A(x)∧B(x))=>(∃x)A(x)∧(∃x)B(x)

  • 2021-04-14 问题

    以下谓词蕴含式正确的是(): (?x) (A(x)→B(x))=>( ?x)A(x)→(?x)B(x)|(?x) (A(x)?B(x))=>( ?x)A(x)?(?x)B(x)|(?x)A(x)∨(?x)B(x)=>( ?x) (A(x)∨B(x))|(?x) (A(x)∧B(x))=>(?x)A(x)∧(?x)B(x)

    以下谓词蕴含式正确的是(): (?x) (A(x)→B(x))=>( ?x)A(x)→(?x)B(x)|(?x) (A(x)?B(x))=>( ?x)A(x)?(?x)B(x)|(?x)A(x)∨(?x)B(x)=>( ?x) (A(x)∨B(x))|(?x) (A(x)∧B(x))=>(?x)A(x)∧(?x)B(x)

  • 1 2 3 4 5 6 7 8 9 10