Java Basic Interview Questions


Java Programming Language

Java programming language is the most widely used language in the world. Java was developed by Sun Microsystems Inc in 1991, but later it was acquired by Oracle Corporation. It was developed by James Gosling and Patrick Naughton. It is a simple programming language with easy writing, compiling and debugging of program.

Java Virtual Machine (JVM)

This is basically referred as JVM. Before discussing JVM, lets understand the phases of program execution. Phases of program execution are as follows: we write the program, then we compile the program and at the end we run the program.

1) Writing of the program can be done by professional java programmer.

2) After that code will be compiled by javac compiler, javac is the primary java compiler included in java development kit (JDK). It take java program as input and generates java bytecode as output.

3) At last, JVM executes bytecode generated by compiler, which is a program run phase.

Therefore primary function of JVM is to execute the bytecode produced by compiler. Every operating system has different type of JVM, but final output they produce after execution of bytecode is same across all operating systems. Thus java is a platform independent language. There are many online java basics tutorial available like tutorialspoint java, w3schools java to create java basic programs. You can also download core java pdf to create core java programs.

 

Java Development Kit(JDK)

As the name itself suggests that this is complete java development kit that includes JRE (Java Runtime Environment), compilers and various tools like JavaDoc, Java debugger etc.

To create, compile and run Java program you will need JDK installed on your machine.

Java Runtime Environment(JRE)

JRE is the subset of JDK which means that JDK includes JRE. When you have JRE installed on your machine, even then you can run a java program but you won’t be able to compile it. JRE contains JVM, browser plugins and applets support. When you only need to run a java program on your computer machine, only JRE needed.

Jave follow OOPs concepts and organize programs as a collection of objects. Java object oriented concepts are as follows:

1) Object : An object can be anything that can execute a set of activities. The set of activities that object performs refers the object's behavior. For example, hand of a person (object) can grip something, or a Student (object) can provide their name or address.

2) Class : A class is just a representation of type of object. It can be either plan or template, that describes the details of an object. A class is actually blueprint from which the individual objects are instantiated. Class is composed of three things: name, attributes and operations.

3) Inheritance : Inheritance is an ability to create new class, from an existing class by extending it. As abstraction is closely related with generalization, the inheritance is closely related with specialization. It is very important to discuss these two concepts together with generalization to understand and reduce the complexity. The specialization and generalization relationships are both reciprocal and hierarchical. Specialization is just the flip side of the generalization coin.

4) Polymorphism : Polymorphisms means 'many shapes'. More specifically Polymorphisms means the ability to request that the same operations can be performed by a wide range of different types of things.

5) Abstraction : Abstraction is basically an emphasis on the idea, qualities and properties rather than the particulars. Abstraction has an ability to hide irrelevant details with use of names to reference objects. Abstraction is the construction of programs. It places the emphasis on what an object is or what it does rather than how it is represented or how it works. Therefore, its a primary means of handling complexity in large programs.

6) Encapsulation : The encapsulation is a container of program objects which are required for the object to function, generally this contains methods and data. In OOP the encapsulation is achieved by creating classes which expose public methods and properties.

 

Design patterns in java

Design patterns are very important since it is ageneral solution to commonly occurring problem during designing phase of software. Java design patterns are divided into three categories: creational, structural, and behavioral design patterns. Pattern programs in java makes code reusable.

Here are some java programming questions to crack interviews easily:

  • What is Java?
  • What are basic concepts of OOPS in java?
  • What is java class?
  • Can we override static method in Java?
  • What is Polymorphism?
  • What is Encapsulation?
  • What is Inheritance?
  • What are manipulators?
  • What is constructor?
  • What is Destructor?
  • What is Method hiding?
  • What is dynamic or run time polymorphism?
  • Difference between class and an object?
  • What is Method Overloading and Overriding?
  • What are the rules for Method Overloading?
  • What is an object?
  • Can we override a private method in Java?
  • What is Functional Interface?


Summary:
Java is an object oriented programming language which is the most widely used language around the globe. Java is official language for android app development.

Some of the many Java Interview Questions listed below will help you get an idea about what questions gets asked in such jobs related to Software Engineering & Tech. Get through the Java Interview bar with our selected Java Interview Questions for all Java enthusiasts!


eduthrill-download-image

For thousands of similar Java Basic Interview Questions download EduThrill..

Experience the thrill of challenging people around the world on Java Basic Interview Questions!


logo-eduthrill