Java教程

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:2: class main is public, should be declared in a file named main.java public class main的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!