A: void Test(int i){}
B: test(int i){}
C: void test(int i){}
D: Test(int i){}
举一反三
- 中国大学MOOC: 如下所示的Test类的Java程序中,共有几个构造方法()。 public class Test{ private int x; public Test(){} public void Test(int i){ this.x=i; } public Test(String str){} }
- 下列代码的执行结果是 。public class Test {public int aMethod(){static int i=0;i++;System.out.println(i);}public static void main(String args[ ]){Test test = new Test();test.aMethod();}}
- 已有如下程序: public class Test{ public Test(int x,int y,int z){.....} } 下面哪些方法是合法的构造方法重载:( ) A: Test(){} B: int Test(){} C: Test(int x,int y,byte z){} D: void Test(int x,int y,int z){}
- 以下是"public static void test(int x, int y)"的方法重载( ) A: public static void Test(int x) B: public static int test(int x, int y) C: public static void test(int y, int x) D: public static void test(int x, int y)
- 已知下面的类:class Test {int a;Test (int i) { a = i; }编写一个名为swap()的方法来交换两个Test对象引用所引用对象的内容。
内容
- 0
有如下代码,则该程序运行时输出结果是。 class Test{ static int i=0; public void show() { i++; System.out.println(i); } } public class Demo { public static void main(String[] args) { Test test=new Test(); test.show(); } }
- 1
已知程序中已经定义了函数test,其原型如下: int test(int, int, int);则下列重载形式中正确的是( )。 A: char test(int,int,int); B: int test(int,int,double); C: int test(int,int,int=0); D: int TEST(int,int);
- 2
【单选题】与下述函数原型声明等价的是_______________。 int test(int a[3],int a[3][3]); (1.0分) A. int test(int a[],int a[][]); B. int test(int a[],int a[3][]); C. int test(int a[],int a[][3]); D. int test(int a[3],int a[3][]);
- 3
已知程序中已经定义了函数test,其原型是int test(int,int,int);,则下列重载形式中正确的是( ) A: double test(int,int,double); B: int test(int,int,int=0); C: float test(int,int,float=3.5F); D: char test(int,int,int);
- 4
已知程序中已经定义了函数test,其原型是int test (int,int,int);,则下列重载形式中正确的是( )。 A.char test(int, int, int); B.double test (int,int,double); C.int test(int ,int, int=0); D.float test(int,int,float=3.5F);