编程语言
首页 > 编程语言> > Main.java:2: class main is public, should be declared in a file named main.java public class main

Main.java:2: class main is public, should be declared in a file named main.java public class main

作者:互联网

 

Main.java:2: class main is public, should be declared in a file named main.java public class main

 

搜了很多解决办法,都是说类名要和文件名改成一样的,明明我改的确实是一样的鸭。。我还问了强者大哥大姐们,怎么改都是报这个错(;′⌒`)

。。。。。

后来一个同学告诉我,原来是PTA的平台问题:

http://www.cnblogs.com/zhrb/p/6347738.html

 

 

类名文件名都得是 Main,最后改完终于成功啦

下面提交第一行要去掉

package he1;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int foot;
		//double inch;
		Scanner in = new Scanner(System.in);
		foot = in.nextInt();
		//inch = (foot-32)*5/9;
		System.out.println((int)((foot-32)*5/9.0));
		in.close();
	}

}

  

标签:main,java,class,foot,Main,public
来源: https://www.cnblogs.com/sun45/p/16156675.html