更多"阅读下面程序 publicclasslncrement publi"的相关试题:
[单项选择]请阅读下面程序 publicclassExampleStringBuffer{ publicstaticvoidmain(String[]args){ StringBuffersb=newStringBuffer("test"); System.out.println("buffer-,"+sb); System.out.println("longth="+sb.1ength( ));}} 程序运行结果中在“length”后输出的值是( )。
A. 10
B. 4
C. 20
D. 30
[单项选择]阅读下面程序
public class Cycle
public static void main(String[] args)
System.out.println(args[0]);
在命令行输入java Cycle one two,该程序输出的结果是
A. Cycle
B. one
C. two
D. 以上三个选项都不对
[单项选择]阅读下面程序 public class MyVal { public static void main(String[]args) { MyVal m=new MyVal( ); m.amethod( ); } public void amethod( ) { boolean b[]=new Boolean[5]; } } 程序编译或运行的结果是
A. 1
B. null
C. ""
D. 编译不通过
[单项选择]阅读下面程序
public class VariableUse
public static void main(String[] arqs)
int a;
if(a==8)
int b=9;
System.out.println("a="+
A. ;
B. ;
[单项选择]阅读下面程序
public class Test3
public static void main(String[] args)
int x=3,y=4,z=5;
String s="xyz":
System.out.println(s+x+y+z);
程序运行的结果是
A. xyz12
B. xyz345
C. xyzxyz
D. 12xyz
[单项选择]阅读下面程序
public class Test4
public static void main(String[] args)
int 1=10,j=3;
float m=213.5f,n=4.0f;
System.out.println(i%j);
System.out.println(m%n);
程序运行的结果是
A. 1.0和1.5
B. 1和1.5
C. 1.0和2.5
D. 1和2.5
[单项选择]阅读下面程序
class Test implements Runnable
public static void main (String[] args)
Test t=new Test( );
t.start( );
public void run( )
下列关于上述程序的叙述正确的是______。
A. 程序不能通过编译,因为start()方法在Test类中没有定义
B. 程序编译通过,但运行时出错,提示start()方法没有定义
C. 程序不能通过编译,因为run()方法没有定义方法体
D. 程序编译通过,且运行正常
[单项选择]阅读下面程序
class Test implements Runnable
public static void main(String[] args)
Test t=new Test( );
t.start( ):
public void run( )
下列关于上述程序的叙述正确的是
A. 程序不能通过编译,因为start()方法在Test类中没有定义
B. 程序编译通过,但运行时出错,提示start()方法没有定义
C. 程序不能通过编译,因为run()方法没有定义方法体
D. 程序编译通过,且运行正常
[单项选择]阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start( ); } public void run( ) { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是
A. Test t=new Test();
B. Thread t=new Thread();
C. Thread t=new Thread(new Test());
D. Test t=new Thread();
[单项选择]
阅读下面程序
public class Test1 {
public static void main(String[] args){
System.out.println(34+56-6);
System.out.println(26*2-3);
System.out.println(3*4/2);
System.out.println(5/2);
}
}
程序运行结果是()
A. 84 49 6 2
B. 90 25 6 2.5
C. 84 23 12 2
D. 68 49 14 2.5
[单项选择]阅读下面程序 public class Cycle { public static void main(String[] args) { System.out.println(args[0]); } } 在命令行输入java Cycle one two,该程序输出的结果是
A. Cycle
B. one
C. two
D. 以上三个选项都不对
[单项选择]阅读下面程序 public class Increment } public static void main(String args[]) { int c; c=5; System.out.println(C) ; System.out.println(c++); System.out.println(C) ; } } 程序运行的结果是
A. 5 6 6
B. 5 5 6
C. 6 7 7
D. 6 6 6
[单项选择]
阅读下面程序
class Test implements Runnable {
public static void main(String[] args) {
Test t = new Test( );
t.startO;
}
public void run( ){ }
}
下列关于上述程序的叙述正确的是()
A. 程序不能通过编译,因为start()方法在Test类中没有定义
B. 程序编译通过,但运行时出错,提示start()方法没有定义
C. 程序不能通过编译,因为run()方法没有定义方法体
D. 程序编译通过,且运行正常
[单项选择]
阅读下面程序
public class ConcatTest{
public static void main(String[] args) {
String strl = "abc";
String str2 = "ABC";
String str3 = str1.concat(str2);
System.out.println(str3);
}
}
程序的运行结果是:()
A. abe
B. ABC
C. abcABC
D. ABCabc
[单项选择]阅读下面程序
public class Test3
public static void main (String args[])
int x=3,y=4,z=5;
String S="xyz";
System.out.printIn(s+x+y+z);
程序运行的结果是______。
A. xyz12
B. xyz345
C. xyzxyz
D. 12xyz
[单项选择]阅读下面程序
public class Test2
public static void main (String args[])
int a=10, b=4, C=20, d=6;
System.out .printIn(a++*b+c*--d);
程序运行的结果是______。
A. 144
B. 160
C. 140
D. 164
[单项选择]阅读下面程序
public class Test2
public static void main(String[] args)
int a=10,b=4.c=20,d=6;
System.out.println(a++*b+c*--d);
程序运行的结果是
A. 144
B. 160
C. 140
D. 164
[单项选择]阅读下面程序,程序执行后的结果为( )。
#include"stdio.h"
main( )
char*str="abcdefghijklnmopq":
while(*str++!='e');
printf("%c/n",*str);
A. f
B. a
C. e
D. a