package code.now;
class Test {
public void fun() {
System.out.println("Coding Ninjas");
}
}
class Derived extends Test {
public void fun() {
System.out.println("Coding Ninjas");
}
public static void main(String[] args) {
Derived obj = new Derived();
obj.fun();
}
}
i'm trying to execute this code and running into the below error
"Error: Main method not found in class code.ninja.Derived, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application"
but I already defined the main method and also tried to check for any syntax and spelling mistakes but still the code is returning the error.
Derived
goes inDerived.java
andTest
goes inTest.java
. Also, you currently overload the single function fromTest
inDerived
(and just duplicated the code when you did so). That is both confusing and pointless. Also your declared package iscode.now
but your error message is fromcode.ninja
. – Gulleymain
should bepublic
– Pistareen