请教大家:如何modify java code in order to compile# Java - 爪哇娇娃
m*2
1 楼
比如说,我们练习都会从
public boolean xyzThere(String str) {
return str.contains("xyz") && !str.contains(".xyz"); }
直接开始。
但是如果把以上代码放到eclipse 或者compile and execute java online上的main
class 里,
给出错误是:
at least one public class is required in main file
所以在开头又加上
public class HelloWord{
错误是缺少 public static void main(String []args)
但是加上之后,还是不对。
向请教大家,应该怎么解决这个问题?
非常感谢:)
public boolean xyzThere(String str) {
return str.contains("xyz") && !str.contains(".xyz"); }
直接开始。
但是如果把以上代码放到eclipse 或者compile and execute java online上的main
class 里,
给出错误是:
at least one public class is required in main file
所以在开头又加上
public class HelloWord{
错误是缺少 public static void main(String []args)
但是加上之后,还是不对。
向请教大家,应该怎么解决这个问题?
非常感谢:)