Compile Error
/in/Main.java:2: error: class jieda2 is public, should be declared in a file named jieda2.java public class jieda2 { ^ 1 error
代码
import java.util.Scanner;
public class jieda2 {
public static void main(String[] args){
Scanner input=new Scanner(System.in);
System.out.println("输入数据:");
int i=input.nextInt();
String msg="";
int fact=1;
if(i<1){
System.out.println("程序有误");
return;
}
System.out.print(i+"!=");
for(int number=1;number<i;number++){
msg+=number+"*";
fact*=number;
}
fact*=i;
msg+=i+"="+fact;
System.out.println(msg);
}
}