更多"有以下源程序: package test; public clas"的相关试题:
[单项选择]有以下源程序: package test; public class ClassA { int x=20; static int y=6; public static void main(String args[]) { ClassB b=new ClassB( ); 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. 编译不通过
[单项选择]下面程序段的输出结果为
package test;
public class ClassA
int x=20;
static int y=6;
public static void main(String args[])
ClassB b=new ClassB( );
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. 编译不通过
[单项选择]下面程序段的输出结果为
package test;
public 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 Class B
int x;
void go(int y)
ClassA a=new ClassA( );
x=a.y;
A. x=10
B. x=20
C. x=6
D. 编译不通过
[单项选择]下面程序段的输出结果为______。
package test;
public class ClassA
int x=20;
static int y=6;
public static void main(String args[])
ClassB b=new ClassB( );
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. 编译不通过
[单项选择]应用程序Test.java的源程序如下,在命令行键入:
java Test aaa bb c
回车后输出的结果是 ______。
public class Test
public static void main(String args[])
int k1=args.length;
int k2=args[1].length______;
System.out.print(k1+" "+k2);
A. 3 2
B. 1 2
C. 1 3
D. 3 3
[单项选择]以下程序输出结果为( )。
class test 2
public static void main(String args[])
int n=7;
n<<=3;
n=n&n+1 |n+2^n+3;
n>>=2;
System.out.println(n);
A. 0
B. -1
C. 14
D. 64
[单项选择]以下程序输出结果为( )。
class test 2
public static void main(String args[])
int n = 7;
n<<=3;
n=n&n+1|1n+2^n+3;
n>>=2;
System.out.println(n);
A. 0
B. -1
C. 14
D. 64
[单项选择]以下程序段输出结果为( )。
class test_1
public static void main(String args[])
int x=0;
boolean b1,b2,b3,b4;
b1=b2=b3=b4=true;
x=(b1|b2&b3^b4)x++:--x;
System.out.println(x);
A. 1
B. 0
C. 2
D. 3
[填空题]类Test定义如下:
public class Test{
public static void main(String args[])
{
String sty=new String("abcde");
char ch[]={’A’,’B’,’C’,’D’,’E’};
ml(str,ch);
System.out.print(str+",");
System.out.println(ch);
}
public static void ml(String s,char ch[])
{
s="Hello";
ch[3]=’Z’;
}
}
那么程序的执行结果为: 【9】
[单项选择]有如下程序 public class Test { int a,b; Test ( ) { a = 100; b = 200; } Test(int x, int y) { a = x; b = y; } public static void main(String args[]) { Test Obj1 = new Test(12,45); System.out.println("a = "Obj1.a+" b = "+Ob31.B) ; Test Obj1 = new Test( ); System.out.println("a = "Obj1.a+" b = "+Obj1.B) ; } } 程序的运行结果为( )。
A. a=100 b=200 a=12 b=45
B. a=12 b=45 a=100 b=200
C. a=12 b=200 a=100 b=45
D. a=100 b=45 a=12 b=200
[填空题]汇编语言的最主要的功能是将汇编语言源程序翻译成目标程序。它还具有以下功能:对源程序进行检查,并给出错误信息;展开宏指令;给出列表文件;根据用户定义自动分配存储区和______.