标签:
public class JavaTest{ public static void main(String[] args){ System.out.println("java Test for windows/linux"); } }
使用javac JavaTest.java; java JavaTest命令进行测试,顺利通过。 编译中间产生的JavaTest.class 可以放到不同的jvm虚拟机中进行解释执行。
import javax.swing.*; public class JavaDialog{ public static void main(String[] args){ JOptionPane.showMessageDialog(null, "Hello JavaDialog"); } }
public class BinaryString{ static String bString(int num){ String result = ""; StringBuffer sb = new StringBuffer(""); int zerosNumber = Integer.numberOfLeadingZeros(num); while(zerosNumber-- != 0){ sb.append("0"); } result = sb.toString()+Integer.toBinaryString(num); return result; } public static void main(String[] args){ int x = 10; System.out.println("x="+x+"("+bString(x)+")"); //F:\java-tmp>java BinaryString //x=10(00000000000000000000000000001010) } }
标签:
原文地址:http://blog.csdn.net/waldmer/article/details/46500201