首页 > 大学专科> 电子信息
题目内容 (请给出正确答案)
[主观题]

请写出下面程序的运行结果: public class Test extends TT{ public static void main(

请写出下面程序的运行结果: public class Test extends TT{ public static void main(String args[] Test t=new Test ("Tom."); } public Test(String s){ super (s); System.out.print("How are you?"); } public Test(){ this("I am Jack."); } } class TT{ public TT(){ System.Out.print ("Hi!"); } public TT(String s){ this (); System.out.print("I am"+s); } } 结果:【 】。

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“请写出下面程序的运行结果: public class Tes…”相关的问题
第1题
写出下面程序的运行结果______。 import java.io.*: publicClassAbc { public stat
ic void main(StringArgs[]) { String s1="Hello!"; String s2=new String("World!"); System.out.println(s1.concat(s2)); } }

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

}

}

点击查看答案
第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题
阅读下面程序,写出输出结果。#include using namespace std ; class A { int a, b; public :
阅读下面程序,写出输出结果。#include using namespace std ; class A { int a, b; public :

阅读下面程序,写出输出结果。

#include using namespace std ; class A { int a, b; public : A() { a = b = 0; }

A(int aa, int bb) { a = aa; b = bb; cout << a << ' ' << b << endl ; } }; int main() { A x, y(2,3);

return 0; }

点击查看答案
第5题
阅读下列程序,写出程序运行结果。import j ava. util. StringTokenizer;public class C3301{pu

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

import j ava. util. StringTokenizer;

public class C3301

{

public static void main(String[] args)

{

String ss="public static void main";

StringTokenizer pas=new StringTokenizer(ss, " ") ;

int n=pas. countTokens() ;

System. out. println(n) ;

String s=pas. nextToken() ;

for(pas. nextToken() ; pas. hasMorcTokens() ; s=pas. nextToken()

System. out. println(s) ;

}

}

点击查看答案
第6题
阅读下列程序并写出程序运行结果。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上的输出结果。

点击查看答案
第7题
阅读下列程序,写出程序运行结果。class A1{public void f(int aa, int bb){System. out. print

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

class A1

{

public void f(int aa, int bb)

{

System. out. println(aa+bb) ;

}

}

class A2 extends A1

{

public void f(int aa, int bb)

{

System. out. println(aa-bb) ;

}

}

public class C3201 extends A2

{

public void f(int aa, int bb)

{

System. out. println(aa*bb) ;

}

public static void main(String[] args)

{

A1 a=new Al() ;

A1 a1=new A2() ;

A2 a2=new C3201() ;

a. f(20, 10) ;

a1. f(20, 10) ;

a2. f(20, 10) ;

}

}

点击查看答案
第8题
下面Java程序的运行结果:()public class NULL { public static void haha(){ System.out.prin
下面Java程序的运行结果:()public class NULL { public static void haha(){ System.out.prin

tln("haha"); } public static void main(String[] args) { ((NULL)null).haha(); } }

A.无法正常运行

B.NULL

C.null

D.haha

点击查看答案
第9题
分析并写出下面程序的运行结果

分析并写出下面程序的运行结果

请帮忙给出正确答案和分析,谢谢!

点击查看答案
第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){}

}

}

}

}

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