String s;
public void init(){
//*********Found********
s = getParameter(_\____); }
public void paint(Graphics g){ g.drawString(s,20,20); } }
3. import javax.swing.*;
//*********Found******** import __ java.text___.*;
public class Java_3 {
public static void main( String args[] ) {
//*********Found********
SimpleTime t = new _ SimpleTime_____ ( 12, 30, 19 );
//*********Found********
_ JOptionPane.showMessageDialog_____( null, t.buildString(), \ //*********Found********
__JOptionPane____.INFORMATION_MESSAGE );
System.exit( 0 ); } }
class SimpleTime {
private int hour, minute, second;
public SimpleTime( int hour, int minute, int second ) {
this.hour = hour;
//*********Found********
__this.minute____ = minute; this.second = second; }
public String buildString() {
//*********Found********
return \this.toString()_____ + \
\ this; }
public String toString() {
DecimalFormat twoDigits = new DecimalFormat( \
return twoDigits.format( this.hour ) + \ twoDigits.format( this.minute ) + \ twoDigits.format( this.second ); } }
第六套:
1.public class Java_1 {
public static void main(String args[]) {
final char chrA='A'; char chrDisplay;
//*************Found********** for(int i=0;i<=25_____;i++)
{
//************Found************ chrDisplay=_(char)____(chrA+i); System.out.print(chrDisplay) ; } } }
2. import java.applet.*; import java.awt.event.*;
import java.awt.Graphics; import java.awt.*; import javax.swing.*;
public class Java_2 extends Applet { private String strCaption; public void init() {
strCaption=\
//************Found*****************
strCaption=this.__ getParameter____(\
//加入一个按钮
Button btnDisp=new Button(\显示参数\ this.add(btnDisp) ;
//事件监听
btnDisp.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//***************Found***************** JOptionPane._
showMessageDialog_____(null,\
参数为:\ } }) ; } }
3. import javax.swing.*; import java.awt.event.*; import java.awt.*; public class Java_3 {
public static void main(String args[]) {
Frame frame=new Frame(\全国计算机等级考试\ frame.setLayout(new FlowLayout()) ;
final TextField txt=new TextField(\二级Java等级考试\ frame.add(txt) ;
Button btn=new Button(\新内容\ frame.add(btn);
btn.addActionListener(new ActionListener()
Caption的值
{
public void actionPerformed(ActionEvent e) {
String strNew;
//***********Found***************
strNew=JOptionPane.__ showInputDialog____(\输入新的字符串\ //***********Found*************** //将新字符串内容在txt中显示出来 txt.__ setText____(strNew) ; } }) ;
Button btnSel=new Button(\选中前三个字符\ frame.add(btnSel) ;
btnSel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//*************Found************** //选中前三个字符
_txt.select(0,3) _____;
txt.requestFocus(); } });
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0) ; } }) ;
frame.setSize(300,100) ; frame.setVisible(true) ; } }
第七套:
1. public class Java_1 {
public static void main(String args[]) { int a=9,b=5,c=7,t;
//*********Found**********
if(a>b){ t=a; a=b; __b=t____;} if(a>c){ t=a; a=c; c=t;}
//*********Found********** if(_b>c_____){ t=b; b=c; c=t;}
System.out.println(\ } }
2. import java.util.*; import java.io.*; public class Java_2 {
public static void main(String args[]) {
int a,b,c;
Random r=new Random();
for(int i=0;i<3200;i++) {
try {
//*************Found**************** a=r._ nextInt______() ; //得到一个随机数 //*************Found**************** b=r.___ nextInt_____() ; //得到一个随机数 c=a/b; }
//*************Found**************** __
catch___(Exception e)
{
System.out.println(\不能被零除!\ c=0; }
System.out.println(\结果为:\ }
} }
3. import javax.swing.*; import java.awt.event.*; import java.awt.*;