整理
一、消息框
import javax.swing.JOptionPane; // import class JOptionPane public class Welcome2 { public static void main( String args[] ) { JOptionPane.showMessageDialog( null, "Welcome\nto\nJava\nProgramming!" ); System.exit( 0 ); // terminate the program } }
二、接受参数,取值
public class JavaAppArguments { public static void main(String[] args) { System.out.println("参数个数:"+args.length); for (String arg : args) { System.out.println(arg);} } }
三、double精度损失
public class TestDouble { public static void main(String args[]) { System.out.println("0.05 + 0.01 = " + (0.05 + 0.01)); System.out.println("1.0 - 0.42 = " + (1.0 - 0.42)); System.out.println("4.015 * 100 = " + (4.015 * 100)); System.out.println("123.3 / 100 = " + (123.3 / 100)); } }
四、输出
public class TestDouble { public static void main(String args[]) { int X=100; int Y=200; System.out.println("X+Y="+X+Y); System.out.println(X+Y+"=X+Y"); } }