一:源程序:
View Codepackage javapTest;
public class JavapTip {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String strWithStr = JavapTip.withStrings(5);
String strWithStrBuf = JavapTip.withStringBuffer(5);
System.out.println("strWithStr="+strWithStr);
System.out.println("strWithStrBuf="+strWithStrBuf);
}
private static String withStrings(int count) {
String s = "";
for (int i = 0; i < count; i++) {
s += i;
}
return s;
}
private static String withStringBuffer(int count) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < count; i++) {
sb.append(i);
}
return sb.toString();
}
}
二:源程序存放的位置:
三:打开cmd,输入
E:\WHY\workspace\cnblogs\src\javapTest>javac -d E:\WHY\workspace\cnblogs\bin JavapTip.java
E:\WHY\workspace\cnblogs\src\javapTest>cd ..
E:\WHY\workspace\cnblogs\src>cd ..
E:\WHY\workspace\cnblogs>cd bin
E:\WHY\workspace\cnblogs\bin>java javapTest.JavapTip
四:类文件存放的位置: