The Free Online Tutorials, and Always will be.

Java Interview Questions

What is java ?

Java is a high level general purpose programming language ie. class based, object-oriented, platform independent, high performance and robust.
Java is widely used in android apps , web apps, and embedded apps.

What are the features of Java?

Simple -> java is based on c, c++. so anyone know the first programming language i.e c then it is easy to learn java.
Object-Oriented -> this feature enables the structure of code easy to write and maintain. objects interact with each other to perform a specific task.
Portable -> java follows the principle WORA (write once read anywhere). in java the program is compiled into byte code in that way java program can run on any machine.
Platform Independent -> every programming language needs a platform (operating system) to be execute.
but, java programs i.e (byte code) run on any machine because each machine understands the byte codes.
Secured -> java uses the concept of byte with exception handling that enables it secured.
Robust -> java uses automatic memory management and garbage collection,, eception handling, type checking at compile time makes java a robust language.
Interpreted -> java compiles the sorce code in byte codes then it interprets by using Just-in-time (JIT) interprets at any machine for execution.
Multithreaded -> this feature allows a app to perform various tasks to perform simultaneously by assign a thread (responsible for performing single sub-task).
it uses multiple threads to perform different sub tasks of a task. it makes apps more responsive to the users.
Distributed -> it allows users to create distributed apps that runs on any machine over the internet.
High Performance -> this feature makes java faster because the source code is compiled in byte code thats makes it fast to execute on any machine.

What is JVM ?

JVM stands for Java Virtual Machine. it has a vendor specific implementations on different machines.
jvm is used to run a java program. it calls the main method in java program (.java) files then compiled in byte codes i.e (.class) files which is a machine independent code. it provides a run time environment for executing the java program.

Difference b/w JDK, JRE and JVM ?

JVM stands for Java Virtual Machine. it is an abstract machine i.e you can refer as a concept which is implenented by vendor for the working of the JVM. this means that JVM is a platform dependent. the implementation of JVM is JRE.
it provides runtime environment for executing java programs.
JRE stands for Java Runtime Environment. it is a collection or set of library and programs which are used for develop java apps at run time.
it provides a run time environment. it is a implementation of JVM.
JDK stands for Java Developmentt Kit. it consist of JRE and development tools (libraries and packages).

WORA in Java ?

WORA stands for Write Once Run Anywhere. In java it is achieved by compiling the java programs into the byte codes which is a machine code. the bytecode is not platform dependent and then it can be executed on any machine.

What is an Object ?

Object is an instance of a class. whereas class is a blueprint but object is a physical entity with data and behaviour.
for example :
car is a class then fiat, bmw, wolkswagon are the objects with state and behaviour.