首页 > 职业资格考试
题目内容 (请给出正确答案)
[主观题]

请写出程序运行的结果。publicclassAAA{publicstaticvoidmain(String[]args){intm=0,n=0,t=1234

请写出程序运行的结果。

publicclassAAA{

publicstaticvoidmain(String[]args){

intm=0,n=0,t=1234;

try{m=Integer.parseInt("6666");

n=Integer.parseInt("89ab");

t=8888;

}

catch(NumberFormatExceptione){

System.out.println("发生异常");

}

System.out.println("m="+m+",n="+n+",t="+t);

}

}

运行结果:

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“请写出程序运行的结果。publicclassAAA{publ…”相关的问题
第1题
阅读下列程序并写出程序运行结果。Private Sub Command1_Click()x = 0Do While x < 60x = (x +
阅读下列程序并写出程序运行结果。Private Sub Command1_Click()x = 0Do While x < 60x = (x +

阅读下列程序并写出程序运行结果。

Private Sub Command1_Click()

x = 0

Do While x < 60

x = (x + 3) * (x + 4)

n = n + 1

Loop

Text1.Text = Str(n)

Text2.Text = Str(x)

Text3.Text = Val(Text1.Text) + Val(Text2.Text)

End Sub

写出程序运行后,文件框Text3的结果。

点击查看答案
第2题
已知程序段:factor=1n=3for i in rang(1,n+1):factor=factor*1print(factor)要求:写出该段程序运行的结果

点击查看答案
第3题
阅读下列程序,请写出程序的运行结果。import java.applet.*;import javax.swing.*;import java

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

import java.applet.*;

import javax.swing.*;

import java.awt.event.*;

public class C extends Applet implements ActionListener

{

int n=0;

JButton button;

public void init()

{

setSize(400,100);

button=new JButton("");

add(button);

button.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

n++;

button.setText(n+"");

}

}

点击查看答案
第4题
阅读下列程序并写出程序运行结果。Private Sub Form_Click()Dim A(1 To 3) As StringDim c As I
阅读下列程序并写出程序运行结果。Private Sub Form_Click()Dim A(1 To 3) As StringDim c As I

阅读下列程序并写出程序运行结果。

Private Sub Form_Click()

Dim A(1 To 3) As String

Dim c As Integer

Dim j As Integer

A(1) = "4"

A(2) = "8"

A(3) = "12"

c = 1

For j = 1 To 3

c = c + Val(A(j))

Next j

Print c

End Sub

写出程序运行时单击窗体后,窗体Form1上的结果。

点击查看答案
第5题
下面程序为变量x,y,z,赋初值2.5,然后在屏幕上打印这些变量的值。程序中存在错误,请改正错误,并
写出程序的正确运行结果

点击查看答案
第6题
写出以下程序的运行结果。#include int fun(int a){int b=0;static int c=3;b ; c ;return(a
写出以下程序的运行结果。#include int fun(int a){int b=0;static int c=3;b ; c ;return(a

写出以下程序的运行结果。

#include int fun(int a){int b=0;static int c=3;b ; c ;return(a b c);}

main(){int i, a=5;for (i=0; i<3; i )cout<< i<< " "<< fun(a)<< " ";}

点击查看答案
第7题
阅读下列程序,请写出程序的运行结果。public class C{public static void main(String[] args)

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

public class C

{

public static void main(String[] args)

{

String text="public static void main(String[] args)";

int theCount=0;

int index=-1;

String theStr="i";

index=text.indexOf(theStr);

while(index>=0)

{

++theCount;

index+=theStr.length();

index=text.indexOf(theStr,index);

}

System.out.println("The Text contains"+theCount+"i");

}

}

点击查看答案
第8题
写出程序运行结果。classPoint{intx,y;Point(intx,inty){this.x=x;this.y=y;System.out.println

写出程序运行结果。

classPoint{

intx,y;

Point(intx,inty){

this.x=x;

this.y=y;

System.out.println("父类构造函数被调用!");

}

}

classCircleextendsPoint{

intradius;

Circle(intr,intx,inty){

super(x,y);

this.radius=r;

System.out.println("子类构造函数被调用!");

}

}

publicclasstestInherence{

publicstaticvoidmain(Stringargs[]){

Circlec1=newCircle(2,2,2);

}

}

运行结果:

点击查看答案
第9题
阅读下列程序并写出程序运行结果。Public Sub change1(ByVal x As Integer, ByVal y As Integer
阅读下列程序并写出程序运行结果。Public Sub change1(ByVal x As Integer, ByVal y As Integer

阅读下列程序并写出程序运行结果。

Public Sub change1(ByVal x As Integer, ByVal y As Integer)

Dim t As Integer

t = x

x = y

y = t

End Sub

Public Sub change2(x As Integer, y As Integer)

Dim t As Integer

t = x

x = y

y = t

End Sub

Private Sub Form_Click()

Dim a As Integer, b As Integer

a = 22: b = 33

change1 a, b

Form1.Print "A1="; a, "B1="; b

a = 22: b = 33

change2 a, b

Form1.Print "A2="; a, "B2="; b

End Sub

写出程序运行时,单击窗体Form1上的输出结果。

点击查看答案
第10题
阅读下列程序,请写出程序的运行结果。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){}

}

}

}

}

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改