网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

运行下列代码后,正确的结果为:  public class Test { static int age; public static void main (String args []) { age = age + 1; System.out.println("age=" + age); } }

A.编译运行后无任何输出

B.编译运行后输出 age=1

C.编译运行后输出 age=0

D.编译出错


参考答案和解析
2 34
更多 “运行下列代码后,正确的结果为:  public class Test { static int age; public static void main (String args []) { age = age + 1; System.out.println("age=" + age); } }A.编译运行后无任何输出B.编译运行后输出 age=1C.编译运行后输出 age=0D.编译出错” 相关考题
考题 下列代码的执行结果为( )。 public class Test1 { public static void main(String args[]){ hat a=3,b=10; System.out.println((a++)*(--b)); }A.40B.36C.30D.27

考题 下列语句输出结果为( )。public class test{public static void main(String args[]){byte b=OXA;System.out.println(b);}}A.OXAB.AC.1D.10

考题 下列程序的运行结果是【 】。public class Test {public static void main (String args[]) {String s1="hello!";System.out.println (s1.toUpperCase());}}

考题 本题中定义了一个带有参数的构造方法javal,并定义了一个该类的对象temp。构造方法javal有两个参数:字符串name和整型age。定义对象temp时将字符串“Tom"和整数17传递给构造方法,构造方法将这两个参数打印输出。 public class javal{ String name; int age; public static void main(String[]args){ String name="Tom"; int age=17; javal temp = ; } public javal(String name, ){ ; this.age= age; System.out.println(name+"is"+age+" years old."); } }

考题 下列代码的执行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(7/2); } }A.3.5B.3C.3.0D.3.50

考题 下列代码的运行结果是( )。 public class Test { public static void main(String args[]) { System.out.println(89>>1); } }A.44B.45C.88D.90

考题 阅读下列代码 public class Test 2005{ public static void main(String args[]){ System.out.println((3>2)?4:5); } } 其运行结果是A.2B.3C.4D.5

考题 阅读下列代码 public class Test{ public static void main(String args[]){ System.out.println(89>>1); } } 其运行结果是A.44B.45C.88D.90

考题 ( 22 )阅读下列代码public class Test{public static void main(String args[]){System.out.println(891) ;}}其运行结果是A ) 44B ) 45C ) 88D ) 90

考题 ( 8 )阅读下列代码public class Test2{public static void main(String args[]){System.out.println(5/2);}}其执行结果是 【 8 】 。

考题 下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i,String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String[]args){ print(99,"Int first"); } }A.String:String first,int:11B.int:11,String:Int firstC.String:String first,int99D.int:99,String:Int first

考题 如下两个源程序文件,分别编译后,运行Example.class文件,运行结果为______。AB.java文件代码如下;package test;public class AB{int a=60;public void show(){System.out.println(”a=”+a);}Example.java文件代码如下:import test.AB;class Example{public static void main(String args[]){AB bj=new AB();obj.show();}}

考题 下列代码的执行结果是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(); }}A.编译错误B.0C.1D.运行成功,但不输出

考题 下列语句输出结果为( )。 public class test { public static void main (String args[ ]) { int a=23,b=8,c=5; int e=a%(b%c); System.out.println(e); } }A.0B.1C.2D.3

考题 下列程序段运行的结果为 public class Test{ static void print(String s,int i){ System.out.println("String:"+s+",int:"+i); } static void print(int i, String s){ System.out.println("int:"+i+",String:"+s); } public static void main(String [] args){ print(99,"Int first"); } }A.String:Stringfirst,int:11B.int:11,String:Int firstC.String:String first,int:99D.int:99,String:int first

考题 下列程序的输出结果是class Test{public static void main(String args[]){int n=7;n 下列程序的输出结果是 class Test{ public static void main(String args[]){ int n=7; n<<=3; n=nn+1|n+2^n+3; n>>=2; System.out.println(n); } }A.0B.-1C.14D.64

考题 下面代码的运行结果是 public class Test{ public static void main(String args[]){ for(int i=0; i<3;i++){ if(i<2) continue; System.out.println(i); } } }A.0B.1C.2D.3

考题 下列代码执行结果为 ( )public class Test{ public static void main(String args[]){ float p=0f; int q=3; System.out.println(++p)*(q--)); }}A.16B.24C.16D.24

考题 下列代码的执行结果是( )。 public class Test1 { public static void main(String args[]) float t = 0f; int q = 5; System.out.println((t++)*(--q)); }A.40B.40C.36D.36

考题 下列代码的执行结果是( )。 public,class Test1 { public static void main(String args[]) { System.out.println(5/2); } }A.2.5B.2.0C.2.50D.2

考题 下列语句输出的结果为( )。 public class test { public static void main(String args[]) { byte b=OXA; System.out.println(b); } }A.OXAB.AC.1D.10

考题 下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.

考题 给出下列的不完整的类代码,则下列的哪个语句可以加到横线处? class Person { String name,department; int age; public Person( String n ){ name = n;} public Person( String n,int a ) { name = n;age = a;} public Person( String n,String d,int a ) { _____________ department = d; } }A.Person(n,a);B.this(Person(n,a) );C.this(n,a);D.this(name,age);

考题 执行下列代码后输出结果为:public class test {public static void main(String args[]) {int a=2;int b=3;int c=7;int d=a>c?a:c;d=d>>2>b? d:b;System.out.println(b);}} A.2B.3C.5D.7

考题 执行以下代码,输出结果的结果是? () public class Test{  public String[] ss = new String[5];    public static void main(String[] args){      System.out.println(ss[1]);  } } A、 nullB、 -1C、 编译时出错D、 运行时报错

考题 class MyApp{   public static void main(String[] args){  int age;   System.out.println(“age=”+age);  }  }   执行上述代码后输出的结果是哪项?()  A、age=0B、age=nullC、age=D、程序编译错误

考题 单选题class MyApp{   public static void main(String[] args){  int age;   System.out.println(“age=”+age);  }  }   执行上述代码后输出的结果是哪项?()A age=0B age=nullC age=D 程序编译错误

考题 单选题Given the uncompleted code of a class:     class Person {  String name, department;     int age;  public Person(String n){  name = n; }  public Person(String n, int a){  name = n;  age = a;  }  public Person(String n, String d, int a) {  // doing the same as two arguments version of constructor     // including assignment name=n,age=a    department = d;     }     }  Which expression can be added at the "doing the same as..." part of the constructor?()A  Person(n,a);B  this(Person(n,a));C  this(n,a);D  this(name,age);