纠错
全专业资料、题库、学位、网课
最高直省2344元
上千+科次精品网课
买网课即送全真模考题库
五千+科次教材资料
电子资料满三件9折
五千+科次在线题库
全真呈现历年考试试题
1、[单选题]为8位字节流数据提供读操作支持的类是()
2、[单选题]在Java语言中,一般不作为容器使用的是()
3、[填空题]在Java语言中,整型常量有十进制、八进制和十六进制三种写法,其中八进制是以数字字符0开头,十六进制是以______开头。
4、[主观题]【程序设计题】设计一个应用程序,原始数据从程序界面的一个文本区输入,用户点击按钮后,在另一个文本区上输出排序后的数据,并将排序后的数据输出到文件中。已给出部分代码,请完成程序。
import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Class3805 implements ActionListener
{
JTextArea ta1=new JTextArea(10,20);
JTextArea ta2=new JTextArea(10,20);
JButton butt=new JButton("SortAndSave");
public static void main(String[] args)
{
new Class3805();
}
public Class3805()
{
JFrame myWin=new JFrame("Class3805");
myWin.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container con=myWin.getContentPane();
con.setLayout(new FlowLayout());
con.setBackground(Color.blue);
con.add(ta1);con.add(butt);con.add(ta2);
myWin.setBounds(200,200,600,300);
butt.addActionListener(this);
myWin.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
//这里是你要编写的代码
}
}
int n=str.countTokens();
int a[]=new int[n];
int i=-1,j;
while(++i
a[i]=Integer.parseInt(str.nextToken());
}
for(i=0;i
if(a[i]>a[j])
{int t=a[i];a[i]=a[j];a[j]=t;}
}
for(i=0;i
ta2.append(a[i]+" ");
}
RandomAccessFile out=null;
try
{
out=new RandomAccessFile("3805.txt","rw");
out.writeBytes(ta2.getText());
}
catch(FileNotFoundException e1){}
catch(IOException e2){}" />
5、[主观题]【程序分析题】阅读下面程序,写出程序功能。
import java.applet.*;import java.awt.*;
public class Class3602 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()
{
int x,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){}
}
else if (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.sleep(40);}
catch(InterruptedException e){}
}
}
}
}
Copyright © 2010 - 2023 湖南求实创新教育科技有限公司 All Right Reserved.
温馨提示:如您需要的资料本网暂时没有,请于工作日08:00-18:00,点击这里,联系客服及时补充资料。