package myPackage;
public class inheritance {
int salary = 50000;
}
class worker extends inheritance {
int bonus = 10000;
public static void main(String[] args) {
worker obj1 = new worker();
System.out.println("employee salary is" + obj1.salary);
System.out.println("employee bonus is" + obj1.bonus);
}
}
Hi.. I am new to java. I am trying to write an inheritance program and getting this error.
Error: Main method not found in class myPackage.inheritance, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application
workerhasmain,inheritancedon't havemain. Run worker instead of inheritance. - ΔȺȾΔ