package fd;
public class Fd {
void f(){
System.out.println("f method is called");
}
}
class j {
public static void main(String[] args){
Fd a=new Fd();
a.f();
}
}
The above program can be executed in the Netbeans IDE
but when the same program is compiled in Eclipse
an error occurs saying
Error: Main method not found in class fd.Fd, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application
So I was wondering if this gotta do with the IDE on which that am running on or is there something else like if its mandatory for putting the main
method in public class
that linked to the package name.
The above program should be written like the one below in order to get it executed in Eclipse
:
package fd;
public class Fd {
public static void main(String[] args){
j a=new j();
a.f();
}
}
class j{
void f(){
System.out.println("f method is called");
}
}