重要提示:请勿将账号共享给其他人使用,违者账号将被封禁!
查看《购买须知》>>>
首页 > 计算机类考试
网友您好,请在下方输入框内输入要搜索的题目:
搜题
拍照、语音搜题,请扫码下载APP
扫一扫 下载APP
题目内容 (请给出正确答案)
[主观题]

以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public stati

以下程序调试结果为:

public class Test {

int m=5;

public void some(int x) {

m=x;

}

public static void main(String args []) {

new Demo().some(7);

}

}

class Demo extends Test {

int m=8;

public void some(int x) {

super.some(x);

System.out.println(m);

}

}

A.5

B.8

C.7

D.无任何输出

E.编译错误

答案
查看答案
更多“以下程序调试结果为:public class Test {int m=5;public void some(int x) {m=x;}public stati”相关的问题

第1题

以下的程序的调试结果为public class Scope{int i;public static void main(String argv[]){Scope s = new Scope();s.amethod();}public static void amethod(){System.out.println(i);}}

A. 输出结果为:0

B. 无输出

C. 编译错误

D. 输出null

点击查看答案

第2题

以下程序调试结果为:class Base{Base(){int i = 100;System.out.print (i);}}public class Pri extends Base{static int i = 200;public static void main(String argv[]){Pri p = new Pri();System.out.print(i);}}

A.编译错误

B.200

C.100200

D.100

点击查看答案

第3题

以下程序的运行结果为()public class IfTest{public static void main(String args[]){int x=3;

A.Not equal

B.Equal

C.无输出

D.编译出错

点击查看答案

第4题

以下程序的输出结果为:public class example {public static void main(String args[]) {int i=0;for (i=0;i<4;i++) {if (i==3、break;System.out.print(i);}System.out.println(i);}}
以下程序的输出结果为:public class example {public static void main(String args[]) {int i=0;for (i=0;i<4;i++) {if (i==3、break;System.out.print(i);}System.out.println(i);}}

A.0123 B.0122 C.123 D.234

点击查看答案

第5题

执行以下程序后,输出结果为public class ex2{public static void main(String args[]) {int f=1;int k;for (k=2;k<5;k++)f*=k;;System.out.println(k);}}
执行以下程序后,输出结果为public class ex2{public static void main(String args[]) {int f=1;int k;for (k=2;k<5;k++)f*=k;;System.out.println(k);}}

A. 0

B. 1

C. 5

D. 4

E. 24

点击查看答案

第6题

若有以下程序:#include using namespace std ; class Point { int x, y; public :Point () {
若有以下程序:#include using namespace std ; class Point { int x, y; public :Point () {

若有以下程序:

#include using namespace std ; class Point { int x, y; public :

Point () { x = 0; y = 0; } void SetPoint (int x1, int y1) { x = x1; y = y1; } void DisPoint () { cout << "x=" << x << "," << "y=" << y << endl ; } }; int main() { Point * p = new Point ; p-> SetPoint (5, 12); p-> DisPoint (); delete p; return 0; } 上面程序的输出结果为:

点击查看答案

第7题

阅读以下程序,选择正确的运行结果()。public class X6 {public static void main(String[] arg

A.55 66

B.66 55

C.66 48

D.55 48

点击查看答案

第8题

阅读下列程序,请写出程序的运行结果。import java.applet.*;import java.awt.*;public class C

阅读下列程序,请写出程序的运行结果。

import java.applet.*;

import java.awt.*;

public class C extends Applet implements Runnable

{

Thread redBall,blueBall;

Graphics redPen,bluePen;

int blueSeta=0,redSeta=0;

public void init()

{

setSize(250,200);

redBall=new Thread(this);

blueBall=new Thread(this);

redPen=getGraphics();

bluePen=getGraphics();

redPen.setColor(Color.red);

bluePen.setColor(Color.blue);

setBackground(Color.gray);

}

public void start()

{

redBall.start();

blueBall.start();

}

public void run()

{

intx,y;

while(true)

{

if(Thread.currentThread()==redBall)

{//以下代码为顺时针画圆

x=(int)(80.0*Math.cos(3.1415926/180.0*redSeta));

y=(int)(80.0*Math.sin(3.1415926/180.0*redSeta));

redPen.setColor(Color.gray);

redPen.fillOval(100+x,100+y,10,10);

redSeta+=3;

if(redSeta>=360)redSeta=0;

x=(int)(80.0*Math.cos(3.1415926/180.0*redSeta));

y=(int)(80.0*Math.sin(3.1415926/180.0*redSeta));

redPen.setColor(Color.red);

redPen.fillOval(100+x,100+y,10,10);

try{redBall.sleep(20);}

catch(InterruptedException e){}

}

elseif(Thread.currentThread()==blueBall)

{//以下代码为顺时针画圆

x=(int)(80.0*Math.cos(3.1415926/180.0*blueSeta));

y=(int)(80.0*Math.sin(3.1415926/180.0*blueSeta));

bluePen.setColor(Color.gray);

bluePen.fillOval(150+x,100+y,10,10);

blueSeta-=3;

if(blueSeta<=-360)blueSeta=0;

x=(int)(80.0*Math.cos(3.1415926/180.0*blueSeta));

y=(int)(80.0*Math.sin(3.1415926/180.0*blueSeta));

bluePen.setColor(Color.blue);

bluePen.fillOval(150+x,100+y,10;10);

try{blueBall.sleepp(40);}

catch(InterruptedException e){}

}

}

}

}

点击查看答案

第9题

关于以下程序代码的说明正确的是()(1) class HasStatic{(2) private static int x=100:(3) publi

关于以下程序代码的说明正确的是() (1) class HasStatic{ (2) private static int x=100: (3) public static void main (String args[]{ (4) HasStatic hs1=new Has Static(); (5) hs1.x + +; (6) Has Static hs2=new HasStatic(); (7) hs2.x + +; (8) hs1=new HasStatic(); (9) hs1.x + +: (10) System.out.println("x="+ x); (11) } (12) }

A.(5)行不能通过编译,因为引用了私有静态变量

B.(10)行不能通过编译,因为x是私有静态变量

C.程序通过编译,输出结果为:x=103

D.程序通过编译,输出结果为:x=100

点击查看答案

第10题

下列程序test类中的变量e的最后结果为()。public class test{ public static void main (String a

下列程序test类中的变量e的最后结果为()。 public class test { public static void main (String args[]) { int a=10; int b; int c; if(a>50) { b=9; } c=b+a; } }

A.10

B.0

C.19

D.编译出错

点击查看答案

第11题

下列程序运行的结果为:public class Example{String str=new String("good");char[]

下列程序运行的结果为:

public class Example{

String str=new String("good");

char[] ch={'a','b','c'};

public static void main(String args[]){

Example ex=new Example();

ex.change(ex.str,ex.ch);

System.out.print(ex.str+" and ");

Sytem.out.print(ex.ch);

}

public void change(String str,char ch[]){

str="test ok";

ch[0]='g';

}

}

A. good and abc

B. good and gbc

C. test ok and abc

D. test ok and gbc

点击查看答案
下载APP
关注公众号
TOP
重置密码
账号:
旧密码:
新密码:
确认密码:
确认修改
购买搜题卡查看答案 购买前请仔细阅读《购买须知》
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《服务协议》《购买须知》
立即支付 系统将自动为您注册账号
已付款,但不能查看答案,请点这里登录即可>>>
请使用微信扫码支付(元)

订单号:

遇到问题请联系在线客服

请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系在线客服
恭喜您,购买搜题卡成功 系统为您生成的账号密码如下:
重要提示:请勿将账号共享给其他人使用,违者账号将被封禁。
发送账号到微信 保存账号查看答案
怕账号密码记不住?建议关注微信公众号绑定微信,开通微信扫码登录功能
请用微信扫码测试
优题宝