本来想写一个关于字符串的类,为了防止eclipse产生混淆,特意把类名写成“Str”,
随后快捷方式生成main方法:
代码如下:
public class Str {
public static void main(Str[] args) {
StringBuffer stb = new StringBuffer(8).append(“1234”);
System.out.println(stb);
}
}
随后就run as,发现无法运行,没有Java Application,还特意找了一下,最后发现是main方法中的 String[] arg 写错,
运行下列代码就没问题了:
public class Str {
public static void main(String[] args) {
StringBuffer stb = new StringBuffer(8).append(“1234”);
System.out.println(stb);
}
}
run as后没有Java Application
最新推荐文章于 2022-03-27 00:27:40 发布