试图编译和运行以下代码的结果是:class base { private base() { system.out.println(0);} public base(int i) {system.out.println(i);} } public class test extends base { public test() {super(1);}; public static void main(string argv[]){ test t = new test(); } }
给定以下代码:public class test { private int i = f(); private int j = 10; private int f() { return j; } public static void main(string args[]) { system.out.println((new test()).i); } } 以下哪句是正确的?
有以下代码:class value { int i; public boolean equals(value v) { return v.i == i; } } public class test { public static void main(string[] args) { hashset set = new hashset(); value v1 = new value(); value v2 = new value(); v1.i = v2.i = 39; set.add(v1); set.add(v2); system.out.println(set.size()); } } 以下哪句是正确的?
试图编译和运行以下代码的时候会发生什么?public class q { public static void main(string argv[]){ int anar[]=new int[5]; system.out.println(anar[0]); } }
对于以下代码:class testbed { testbed() {} void f() { system.out.println("f()"); } public static void main(string[] args) { testbed t = new testbed(); t.f(); } } class testdoor { testdoor() {} void f() { system.out.println("f()"); } public static void main(string[] args) { testdoor t = new testdoor(); t.f(); } } 以下哪句是正确的?
有下面的代码,要如何做,能调用base的构造器来打印出出"base constructor"?class base{ base(int i){ system.out.println("base constructor"); } base(){}} public class basesup extends base{ public static void main(string argv[]){ basesup s= new basesup(); //one } basesup(){ //two } public void derived(){ //three } }
试图编译和运行以下代码的结果是什么? private class base{ base(){ int i = 100; system.out.println(i); } } public class pribase extends base{ static int i = 200; public static void main(string argv[]){ pribase p = new pribase(); system.out.println(i); } }
有以下代码:class value { int i; } public class test { public static void main(string[] argv) { integer v1 = 39; integer v2 = 39; system.out.println(v1.equals(v2)); } } 以下哪句是正确的?
试图编译和运行以下代码的结果是什么?dclass base { private base() { system.out.println(0);} public base(int i) {system.out.println(i);} } public class test extends base { public test() {super(1);}; public static void main(string argv[]){ test t = new test(); } }
试图编译和运行以下代码的结果是什么?class base { void f(int i) {system.out.println("int");} void f(double d) {system.out.println("double");} } public class fin extends base { void f(string s) { system.out.println("string"); } public static void main(string argv[]){ fin a = new fin(); a.f(10); } }
有以下代码:public class test { string s; static class inner { void testmethod() { s = "hello world."; } } public static void main(string[] argv) { inner i = new inner(); i.testmethod(); system.out.println(s); } } 以下哪句是正确的?
有以下代码:interface i { void setvalue(int val); int getvalue(); } 以下哪段代码能编译?
在以下代码中,下列哪句可以放在//here处?class base{ public base(int i){}} public class myover extends base{ public static void main(string arg[]){ myover m = new myover(10); } myover(int i){ super(i); } myover(string s, int i){ this(i); //here } }
以下哪句正确描述了以下代码执行的情况?public class flowap extends frame{ public static void main(string argv[]){ flowap fa=new flowap(); fa.setsize(400,300); fa.setvisible(true); } flowap(){ add(new button("one")); add(new button("two")); add(new button("three")); add(new button("four")); }//end of constructor }//end of application
有以下代码:void f(int port) { return new package(port) { private int pt = port; public getport() { return pt; } }; } 以下哪句是正确的?
对于import java.util.vector; 以下哪种说法是错误的?
一个firstclass.java文件如下:import java.*; public class firstclass {} public interface second {} abstract class secondclass{} 编译后会得到什么错误信息?
有以下程序:class dataserver extends server { public string servername; public dataserver() { servername = “customer service”; super(servername); } } 以下论断哪句是正确的?
有以下程序:class testserver { public testserver() { int users = 1; } public void inc() { users ; } public static void main(string[] args) { testserver ts = new testserver(); ts.inc(); system.out.println(“var users = “ ts.users); } }
java的char类型是8位的。
protected的成员只能被子类成员存取
java数组随时可以改变大小
final的成员变量只能在一个地方初始化。
在java中,一个子类只能继承一个父类
接口的本质就是完全抽象的类
java程序必须要有jdk的支持才能运行
写出以下程序的运行结果:public class test { public int t=4; public static void main(string[] args) { new test().numberplay(); } public void numberplay() { int t=2; t = t 5; this.t = this.t-2; t = t-this.t; system.out.println(t this.t ”ok”); } }
写出以下标出行号的语句的执行顺序: class a { static int i = 0;//1 float f = 1.0;//2 a() { str = “hello”;//3 } } public class b extends a { static int j=3;//4 bool ishi = true;//5 b(bool hi) { ishi = hi;//6 } public static void main(string[] args) { b bb = new b(false); } } 请连续书写数字,中间不留任何符号,如123456
写出程序运行结果:class letter { char c; } public class passobject { static void f(letter y) { y.c = 'z'; } public static void main(string[] args) { letter x = new letter(); x.c = 'a'; f(x); system.out.println(x.c); } }
写出程序运行结果:public class equivalence { public static void main(string[] args) { integer n1 = new integer(47); integer n2 = new integer(47); system.out.println(n1 == n2); } }