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

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

5、下列程序中哪行代码是错误的? public class Exam { public static void main(String args[]) { int x = 8; byte b = 127; //【代码A】 b = x; //【代码B】 long y=x; //【代码C】 float z=6.89F ; //【代码D】 } }

A.【代码A】

B.【代码B】

C.【代码C】

D.【代码D】


参考答案和解析
代码2;代码4
更多 “5、下列程序中哪行代码是错误的? public class Exam { public static void main(String args[]) { int x = 8; byte b = 127; //【代码A】 b = x; //【代码B】 long y=x; //【代码C】 float z=6.89F ; //【代码D】 } }A.【代码A】B.【代码B】C.【代码C】D.【代码D】” 相关考题
考题 以下程序的运行结果为( )。 public class Sun { public static void main(String args[]) { String x="A",y="B",z="C"; for(int m=1;m<=2;m++) { x=y; y=z; z=x; } System.out.println(x+y+z); } }A.ABCB.BCAC.BCBD.CBC

考题 阅读下列代码 public class Test 2005{ public static void main(String args[]){ System.out.println(~(0xa5)0xaA.0xa5B.10C.0x50D.0xaa

考题 下列代码的执行结果是( )。 public class Test { public static void main ( String args[]) { float f=5.0f; int i=4; System.out.println((f++) *(--i)); } }A.20B.20.0C.15D.15.0

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

考题 阅读下列代码Public class Person{Static int arr[ ] = new int (10);Public static void main (String args ) {System.out.println(arr[9]);}}该代码运行的结果是A )编译时将产生错误B )编译时正确,运行时将产生错误C )输出 0D )输出空

考题 执行下列代码段之后,变量b的值为______。 public class ex40 { public static void main(String[] args) { byte x=5; byte y=5; byte c=10; boolean b; b-c<x<<y; System.out.println (b); } }A.1B.0C.falseD.true

考题 下列代码的执行结果是( )。 class operator Test{ public static void main(String[]args){ int x=8; short y=2; system.out.println("xis"+ x + ",yis"+y); } }A.8和2B.8.0和2.0C.8和2.0D.8.0和2

考题 下列代码的执行结果为( )。 public class Testl{ public static void main (String args[]){ int a=3,b=10: System.out.println((a+ +)*(-b)); }A.40B.36C.30D.27

考题 执行下列代码后,输出的结果为( )。 class Base { int x = 30; void setX( ) {x=1O;} } class SubClass extends Base { int x=40; void setX ( ) {x=20;} int getX( ) {return super. x; } } public class Test { public static void main(String[ ] args) { SubClass sub=new SubClass( ); sub. setX( ); System. out. println(sub, getX( ) ); } }A.10B.20C.30D.40

考题 下面代码的执行结果是( )。 public class test { public static void main (String args[]) { float m=5.0f; int n=4; System.out.println((++m)*(n--)); } }A.20.0B.20C.24.0D.24

考题 执行下列代码段之后,变量z的值为______。 Public class Test8 { public static void main(String[] args) { int x=2; int y=3; int z=4; z-....= y-x--; System.out.println(z); }A.1B.2C.3D.4

考题 下列代码的执行结果是( )。 public class Test { public static void main (String args[]) { int a=3,b=5,c=8; String s="abc"; System.out.println(a+b+s+c); } }A.35abc8B.8abc8C.16D.abc

考题 下列代码执行结果为 ( )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 Test{ public static void main(String args[]){ float t=0h int q=5; System.out.println((t++)*(--q)); } }A.41B.41C.36D.36

考题 阅读下列代码: public class Person{ static int arr[]=new int[10]; public static void main(String args){ System.out.println{arr[9]); } } 该代码的运行结果是( )。A.编译时将产生错误B.编译时正确,运行时将产生错误C.输出零D.输出空

考题 执行下列代码段之后,x的值为______。 public class ex25 { public static void main(String[] args) { int x=12; int m=x%5; x>>>=m; System.out.println(x); }A.7B.3C.0D.1

考题 执行下列代码之后,输出的结果为______。 public class ex27 { public static void main(String[] args) { iht x=7; int y=15; boolean bb=(127|x)>7(-128∧y)<15; System.out. println(bb); } }A.trueB.0C.1D.false

考题 下列代码执行之后,输出的结果为______。 public class ex38 { public static void main(String[] args) { int x=12; int m=11; int y=13; int temp=x>y?x:y; temp=temp>m?temp:m; System.out.println (temp); } }A.1B.12C.13D.11

考题 下列代码的执行结果是( )。 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 ex34 { public static void main(String[] args) { byte a=-128; byte b=(a|127)>0?(byte)(~a>>128:(byte)(~a<<128); System. out. Println(b); } }A.-128B.128C.127D.-127

考题 以下代码的输出结果?public class Test{int x=3;public static void main(String argv[]){int x= 012;System.out.println(x);}} A.12B.012C.10D.3

考题 以下代码的输出结果?public class Test{int x=5;public static void main(String argv[]){Test t=new Test();t.x++;change(t);System.out.println(t.x);}static void change(Test m){m.x+=2;}} A. 7B. 6C. 5D. 8

考题 给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test {  public void cal(int x, int y, int z) { } //A } A、public int cal(int x,int y,float z){return 0;}B、public int cal(int x,int y,int z){return 0;}C、public void cal(int x,int z){}D、public viod cal(int z,int y,int x){}

考题 阅读以下代码:  public class Test{  public static void main(){  System.out.println(“x=”+x);   } }  请问,代码运行的结果是?() A、 xB、 x=xC、 “x=”+5D、 编译报错

考题 对于下列代码: 1) class Person {   2} public void printValue(int i, int j) {//... }     3} public void printValue(int i){//... }    4} }   5) public class Teacher extends Person { 6} public void printValue( ) {//... }     7} public void printValue(int i) {//...}     8} public static void main(String args[]){     9} Person t = new Teacher( );     10} t.printValue(10);     11} } 第10行语句将调用哪行语句?()A、 line 2B、 line 3C、 line 6D、 line 7

考题 单选题阅读以下代码:  public class Test{  public static void main(){  System.out.println(“x=”+x);   } }  请问,代码运行的结果是?()A  xB  x=xC  “x=”+5D  编译报错

考题 多选题给定java代码如下所示,在A处新增下列()方法,是对cal方法的重载。public class Test {  public void cal(int x, int y, int z) { } //A }Apublic int cal(int x,int y,float z){return 0;}Bpublic int cal(int x,int y,int z){return 0;}Cpublic void cal(int x,int z){}Dpublic viod cal(int z,int y,int x){}