java课设代码 java代码教学

给段最简单的java代码让我新手看一下最简单的java代码肯定就是这个了 , 如下:
public class MyFirstApp
{
public static void main(String[] args)
{
System.out.print("Hello world");
}
}
“hello world”就是应该是所有学java的新手看的第一个代码了 。如果是零基础的新手朋友们可以来我们的java实验班试听,有免费的试听课程帮助学习java必备基础知识,有助教老师为零基础的人提供个人学习方案,学习完成后有考评团进行专业测试 , 帮助测评学员是否适合继续学习java , 15天内免费帮助来报名体验实验班的新手快速入门java , 更好的学习java!
java课程设计源代码(急?。。。。?/h2>import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;
public class game21 extends JFrame {
private JLabel label_2;
private int number;
private int sum;
final JLabel label = new JLabel();
final JLabel label_1 = new JLabel();
public static void main(String[] args) {
new game21();
}
public game21() {
super("21点java课设代码?java课设代码!");
getContentPane().setLayout(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JButton button = new JButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent arg0) {
onClick();
}
});
button.setText("出牌");
button.setBounds(170, 350, 106, 28);
getContentPane().add(button);
label.setBorder(new LineBorder(Color.black, 1, false));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setFont(new Font("", Font.BOLD, 26));
label.setText("背面");
label.setBounds(158, 81, 137, 153);
getContentPane().add(label);
label_1.setText("java课设代码你已经拥有java课设代码的牌:");
label_1.setBounds(109, 22, 270, 45);
getContentPane().add(label_1);
this.setBounds(200, 300, 501, 528);
this.setVisible(true);
getContentPane().add(getLabel_2());
}
public int randNumber() {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
return (int) (Math.random() * 10 + 1);
}
public void onClick() {
number = this.randNumber();
this.sum += number;
label.setText("" + number);
String strTemp = this.label_1.getText();
strTemp += "" + number + " ";
label_1.setText(strTemp);
String temp = "合计:" + sum;
label_2.setText(temp);
isWin();
}
public void isWin() {
if (sum21) {
JOptionPane.showMessageDialog(this, "java课设代码你输了");
clear();
return;
} else if (sum == 21) {
JOptionPane.showMessageDialog(this, "你赢了");
clear();
return;
} else {
int i = JOptionPane.showOptionDialog(this, "是否继续?", "提示",
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, null, null);
if (i == JOptionPane.OK_OPTION) {
onClick();
} else
return;
}
}
private void clear() {
label_2.setText("合计:");
sum = 0;
number = 0;
label_1.setText("你已经拥有的牌:");
}
/**
* @return
*/
protected JLabel getLabel_2() {
if (label_2 == null) {
label_2 = new JLabel();
label_2.setText("合计:");
label_2.setBounds(313, 35, 66, 18);
}
return label_2;

推荐阅读