1.
- 1 第三范式是在第二范式的基础上消除了: 非主属性对键的传递函数依赖 第三范式是为了消除数据库中关键字之间的依赖关系
- 2.冯诺依曼: 输入 存储 运算 控制 输出
- 3 一般情况下,划分计算机四个发展阶段的主要依据是:计算机所采用的基本元器件 (电子管数字机,晶体管数字机,集成电路数字机,大规模集成电路机)
- 4 计算机在工作室无需人工干预却能够自动连续的执行程序,并得到预期的结果,主要是因为:程序存放在存储器中
- 5 结构中的各节点之间形成一个循环链,有一个以上根结点的数据结构一定是非线性结构
- 6 带链的队列,由于每个元素都包含一个指针域指向下一个元素,当带链队列为空时front=rear=Null,插入第1个元素时,rear+1指向该元素,front+1也指向改元素,插入第2个元素时rear+1,front不变,删除1个元素时front+1.即front=rear不为空时带链的队列中只有一个元素
- 7 Java中每个Applet必须定义为Applet的子类,每个Applet必须至少实现init(),start(),paint()中的方法之一,Applet要嵌入HTML页面中才能运行
- 8 switch语句在数据类型上受到限制,只能使用int,byte,short,char类型.如果比较的数据类型是float型或者boolean类型,就只能使用if-else-if结构
- 9 能直接为数据赋值 String s[] = new String[]{“zero”,“one”…}
- 10 Swing与AWT相比新增的布局管理器是BoxLayout箱式布局
- 11 在Java语言中,被称为内存分配的运算符是new(内存分配运算符)
- 12 接口中,除了抽象方法之外,还可以含有常量
- 13 Thread类是多线程基类,多线程启动类必须继承此类.而实现Runnable接口的类能作为多线程的一个执行任务,一般作为参数传给新的Thread类
- 14 Java中的文件和目录都看出文件,可通过File类的idDirectory()和isFile()方法判断某个File是目录还是标准文件
- 15 Java对象只有在实现Serializable或Extemalizable接口后才可串行化,一些基本类型如String,Integer已实现Serializable接口故可串行化,而没有实现此接口的类型不能串行化.
- 16 Serializable是序列化,将一个对象的状态保存起来,在适当的时候在获得,它不支持线程.
操作题1
package top.xiaoytongxue.Test01;
import javax.swing.*;
public class java1 {
public static void main(String[] args) {
System.out.println();
System.out.println("这是一个指定求半径,求球体积的程序.");
String input = JOptionPane.showInputDialog("请输入球半径.");
double r = Double.parseDouble(input);
System.out.println("当球的半径是"+ r + "时,该球的体积是 " +(Math.PI*r*r*r*4/3) );
System.out.println(0);
}
}
操作题2
package top.xiaoytongxue.Test01;
public class java2 {
public static void main(String[] args) {
Thread t = new SimpleThread("Testing_Thread");
t.start();
}
static class SimpleThread extends Thread{
public SimpleThread(String str) {
setName(str);
}
public void run() {
System.out.println("Running the" + getName() + ":");
for (int i = 0; i < 5; i++) {
System.out.println("---" + i + "---" + getName());
try {
sleep((int) (2 * 100));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
操作题3
package top.xiaoytongxue.Test01;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
public class java3 {
public static void main(String[] args) {
FontFrame frame = new FontFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
// panel,implements,actionPerformed
class FontFrame extends JFrame{
public FontFrame() {
setTitle("北京 2008");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
FontPanel panel = new FontPanel();
Container contentPane = getContentPane();
contentPane.add(panel);
}
public static final int DEFAULT_WIDTH = 400;
public static final int DEFAULT_HEIGHT = 250;
}
class FontPanel extends JPanel {
public FontPanel() {
JButton yellowButton = new JButton("Yellow");
JButton blueButton = new JButton("Blue");
JButton redButton = new JButton("Green");
add(yellowButton);
add(blueButton);
add(redButton);
ColorAction yellowAction = new ColorAction(Color.YELLOW);
ColorAction blueAction = new ColorAction(Color.BLUE);
ColorAction greenAction = new ColorAction(Color.GREEN);
yellowButton.addActionListener(yellowAction);
blueButton.addActionListener(blueAction);
redButton.addActionListener(greenAction);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
String message = "同一个世界,同一个梦想!";
Font f = new Font("隶书", Font.BOLD, 27);
g2.setFont(f);
FontRenderContext context = g2.getFontRenderContext();
Rectangle2D bounds = f.getStringBounds(message, context);
double x = (getWidth() - bounds.getWidth()) / 2;
double y = (getHeight() - bounds.getHeight()) / 2;
double ascent = -bounds.getY();
double baseY = y + ascent;
g2.setPaint(Color.RED);
g2.drawString(message, (int) x, (int) (baseY));
}
//*********Found**********
private class ColorAction implements ActionListener {
public ColorAction(Color c) {
BackgroundColor = c;
}
//*********Found**********
public void actionPerformed(ActionEvent event) {
setBackground(BackgroundColor);
}
private Color BackgroundColor;
}
}