I am trying to Include two or more classes in one file, but java just throws this error message at me! How would I include 2 or more classed in 1 file?
Exception in thread "main" java.lang.ExceptionInInitializerError
at javaapp.main(javaapp.java:25)
Caused by: java.lang.RuntimeException: Uncompilable source code - class functions1 is public, should be declared in a file named functions1.java
at functions1.<clinit>(javaapp.java:11)
... 1 more
Java Result: 1
public class functions1 {
public String Print(String text){
System.out.println(text);
return text;
}
}
public class javaapp {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
functions1 Func = new functions1();
Func.Print("You're learning Java!!!!!");
}
}