⺣ - רҵ·ĵϷƽ̨

ǰλãҳ > JAVA语言程序设计期末考试题及答案【创意版?doc - 百度文库

JAVA语言程序设计期末考试题及答案【创意版?doc - 百度文库

  • 62 Ķ
  • 3
  • 2025/6/4 23:02:35

Ʒĵ C. smallButton.addActionListener(myListener); D. smallButton.addItem(myListener);

1. д룬˵γĹܡ import java.io.*; public class Test{

public static void main( String [] argv) { try {

BufferedReader is =

new BufferedReader( new InputStreamReader(System.in));

String inputLine;

While ((inputLine = is.readLine ())!= null) {

System.out.println(inputLine);

} is.close();

}catch (IOException e) {

System.out.println(\

} } }

𰸣ȡ룬ʾĻϣֱΪΪֹ 2 гдȷн class test {

public static void main (String [] args ){

int x=9, y; if (x>=0)

if (x>0) y=1; else y=0;

else y=-1;

System.out.println(y);

}

} 𰸣1

.

Ʒĵ 3 дȷн public class Father{

int a=100; public void miner(){

a--;

}

public static void main(String[] args){

Father x = new Father(); Son y = new Son(); System.out.println(y.a); System.out.println( y.getA()); y.miner();

System.out.println(y.a); System.out.println(y.getA());

}

}

class Son extends Father{

int a = 0; public void plus(){ a++; }

public int getA() { return super.a; } } 𰸣

0 100 0 99 .

1. JavaԵص㡣

ԣJavaC++C++ĵط JavaԵȫ ֲʽ ִУ

.

Ʒĵ ׳ԣJavaṩԶջƣ쳣ƣϸͼ ƽ̨޹ԣ ȫ ߳ ̬

2. AWT¼ģ͡

AWT¼ģͲ˵ import java.awt.event.*;

1. ʵֶӦ¼Ľӿ

class MyFirstFrame extends Frame implements ActionListener {...}

2ȷ¼Ľӿʽ

public void actionPerformed ( ActionEvent event) {}

3. MyFirstFrame ʵֽӿActionListenerез 4. ע.

Ϊ˰MyFirstFrameעΪť¼󣬱MyFirstFrame Ĺ캯£ cancelButton.addActionListener(this); okButton.addActionListener(this);

3. JavaУһ̣߳

1ʵRunnableӿ

class TestThread implements Runnable { public void run() { } } 2̳Threadʵ

class TestThread extends Thread { TestThread(String name) { super(name); start(); }

public void run() {} }

.

Ʒĵ

.

  • ղ
  • Υٱ
  • Ȩ
ĵ10.00 Ԫ VIP
ߣ...

92ƪĵ

ĵ飺

Ʒĵ C. smallButton.addActionListener(myListener); D. smallButton.addItem(myListener); 1. д룬˵γĹܡ import java.io.*; public class Test{ public static void main( String [] argv) { try { BufferedReader is = new BufferedReader( new InputStreamReader(System.in)); String inputLine; While ((inputLine = is.readLine ())!= null) {

οͿͨغɸƺŰ棩
ƪ
ʱؼۣ10 Ԫ/ ԭ:20Ԫ
VIP
ؼۣ29 Ԫ/ ԭ:99Ԫ
0.3 Ԫ/ ÿ150
ȫվɸ
VIP
ؼۣ29 Ԫ/ ԭ:99Ԫ
0.3 Ԫ/ ÿ150
ȫվɸ
עĵпܡֻĿ¼ݲȫ֮ǰעѸ޷ػ⣬ϵЭ㴦
΢ţfanwen365 QQ370150219
Copyright © ⺣ All Rights Reserved. ICP16052595-3 վͼ ͷQQ370150219 䣺370150219@qq.com