Java SE is also called Core Java. It is the set of libraries that are part of standard java installation. For example, the Collections framework is part of Core Java. But, Servlet/JSP is part of Java Enterprise Edition.
C++ and Java both are object-oriented programming languages with some differences. The interviewer may ask the difference between the two and include this in the top Java interview questions for freshers to check your basic knowledge.
When there is a requirement to share a method or a variable between multiple objects of a class instead of creating separate copies for each object, we use static keyword to make a method or variable shared for all objects.
There are four principle concepts upon which object-oriented design and programming rest. They are:
Looping is used in programming to execute a statement or a block of statement repeatedly. There are three types of loops in Java:
break and continue are two important keywords used in Loops. When a break keyword is used in a loop, loop is broken instantly while when continue keyword is used, current iteration is broken and loop continues with next iteration.
This one is also very popular Java interview questions. This is very big topic and we do have complete tutorial with all details here.
• Abstract Class in Java
• Interface in Java
In Java, access modifiers are special keywords which are used to restrict the access of a class, constructor, data member and method in another class. Java supports four types of access modifiers:
In java, main method must be public static in order to run any application correctly. If main method is declared as private, developer won’t get any compilation error however, it will not get executed and will give a runtime error.
Encapsulation is a technique used for hiding the properties and behaviors of an object and allowing outside access only as appropriate. It prevents other objects from directly altering or accessing the properties or methods of the encapsulated object.