在用命令提示符编译的时候总是提示第7行找不到符号,但是用IDE则可以成功运行。求解释!!代码如下:
public class StringBufferTest
{
public static void main(String[] args)
{
StringBuffer buffer = new StringBuffer(); buffer.append("hello").append(" world").append(" welcome").append(100).append(false);
String result = buffer.toString(); System.out.println(result);
String s = "abc";
int a = 100;
boolean b = true; String str = s + a + b; System.out.println(str); System.out.println("-------------"); int m = 100;
int n = 200; System.out.println("100" + 200); System.out.println("-------------"); System.out.println("false" + true);
//buffer = buffer.append("hello");
//buffer.append(" world");
//buffer.append(" welcome");
}
}
public class StringBufferTest
{
public static void main(String[] args)
{
StringBuffer buffer = new StringBuffer(); buffer.append("hello").append(" world").append(" welcome").append(100).append(false);
String result = buffer.toString(); System.out.println(result);
String s = "abc";
int a = 100;
boolean b = true; String str = s + a + b; System.out.println(str); System.out.println("-------------"); int m = 100;
int n = 200; System.out.println("100" + 200); System.out.println("-------------"); System.out.println("false" + true);
//buffer = buffer.append("hello");
//buffer.append(" world");
//buffer.append(" welcome");
}
}
hello world welcome100false
abc100true
-------------
100200
-------------
falsetrue
我用的JDK1.6.
hello world welcome100false
abc100true
-------------
100200
-------------
falsetrue