Menu

Could not find or load main class MainClass

Error: Could not find or load main class MainClass

While running the Java program user see this compilation error. There are two ways to fix this.

1. Go to package where file is located and run the java compiler javac filename.java

2. Provide full directory path to Java compiler like; javac C:/desktop/jorvee/javasample/javapackage/javafile.java

Why Java doesn't support multiple inheritance?

Java doesn't support multiple inheritance because of deadlock and ambiguity situation.

A class cannot extend two classes, but a class can implement multiple interfaces. So, we use interfaces to achieve multiple inheritance in Java programming.

e.g. Class C extends A, B { //statements }

The above class declaration is invalid in Java programming. but possible in various other programming languages.

e.g. Class C extends A implements D, F { //codes }

The above class declaration is valid in Java. In the above class declaration, we have inherited class A and implementing two interfaces D and F. This way we can implement multiple interfaces in Java.

Example Class C extends Class A and Class B and both classes A and B have evaluate() method. When class C tries to inherit evaluate method then the compiler will get confused and unable to decide which evaluate method to inherit, either from class A or B. So to remove this ambiguity from the program Java doesn't support multiple inheritance.

Why we use Radhiallah Anhu or Anha with the name of companions of Prophet Muhammad SAW?

Radhiallah Anhu or Radhiallah Anha means May Allah be pleased with him/her. It is added after the names of the sahabah (companions of Prophet Muhammad ﷺ) and wives of Prophet Muhammadﷺ as a sign of respect. It is often represented by the acronyms(RA or R). 

Raziallahu Anhu is used for male companions and Raziallahu Anha is used for female companions of Prophet Muhammadﷺ.

Arabic text - 
Radhiallah Anhum رضي الله عنهم (for plural male) and
Rathiallah Anhu رضي الله عنه (for singular male)
Rathiallah Anha رضي الله عنها (for singular female)