另外,JVM和硬件间的毕毁带东西,楼主好像几乎没有概念阿。应该是
jvm --(系统调用)--> *** 作系统 ->hardware
比如楼主你想过java上的多线程是怎么实现的么?java上一个线程是否和 *** 作系统的线程有1:1对应关系?这些楼主想过没?
import java.awt.event.ActionEventimport java.awt.event.ActionListener
import java.awt.event.MouseEvent
import java.awt.event.MouseListener
import javax.swing.JButton
import javax.swing.JFrame
import javax.swing.JLabel
public class A extends JFrame implements MouseListener {
private int index = 0
private String[] msgs = { "java is fun", "java is powerful" }
private JLabel lbl = new JLabel(msgs[index])
public A() {
this.setTitle("test")
this.setSize(300, 200)
this.add(lbl)
lbl.setFocusable(false)
addMouseListener(this)
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
this.setVisible(true)
}
public static void main(String[] args) {
new A()
}
public void mouseClicked(MouseEvent e) {
index = index == 0 ? 1 : 0
lbl.setText(msgs[index])
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)