Top 18 Simple Basic Java Interview Questions For Freshers

About us
1) What are the main features of Java? Below is the list of features of java. a) Object Oriented b) Simple c) Platform Independent d) Secured e) Robust f) Portable g) Multithreaded h) Distributed 2) What are the fundamental principles of object oriented programming? a) Inheritance b) Abstraction c) Polymorphism d) Encapsulation 3) What do you mean by inheritance in java? Inheritance is one in every of the key principle of object minded programming. Through inheritance, one category will inherit the properties of another category. The class from which properties are inherited is called super class and the class to which properties are inherited is called sub class. 4) What is constructor overloading? What is the use of constructor overloading? A class can have any number of constructors. These constructors will have different list of arguments. It is called constructor overloading. Constructor overloading provides other ways to instantiate a category. 5) What is polymorphism in java? Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. Any Java object that can pass more than one IS-A test is considered to be polymorphic. 6) What is the method overloading in java? If a class has more than one method with the same name but with different list of arguments, then it is called method overloading 7) What is the method overriding? If a superclass method is modified in the sub class then it is called method overriding. 8) Does Java supports multiple inheritance? Java supports multiple inheritance but only through interfaces. That means a class can implement more than one interface but can not extend more than one class. 9) What is the difference between constructor and method? Constructor is a special member of a class which is used to create the objects to the class. It is special because it will have the same name as class. It will have no return type. 10) Can we overload the main() method? Yes, we can overload a main() method. A class will have any range of main() strategies. But, one in every of those should be within the kind “public static void main(String[] args)” so as to begin the execution. 11) How the exceptions are handled in java? OR justify attempt, catch and atlast blocks in java? Java has its own mechanism to handle the exceptions. In Java, exceptions ar