Java Fundamental Interview Questions

This page contains java fundamentals/basic interview questoins and their answers. For more questions on various topics of core java navigate thorough the links privided in below table or at bottom of the page.

Overview : Most Imp Questions Java Basic Interview Questions
OOPS Concepts Interview Questions Exception Handling Questions
MultiThreading & Concurrency API Java API : String, File I/O
Collection Framework Questions Advanced Questions

JDK : JDK stands for Java Development Kit. It is a complete bundle containing JRE, java compiler and other utilities for development of java programs. JDK is required to write/compile java programs.

JRE : JRE stands for Java Runtime Environment. It provides the minimum requirements for executing a java application. JRE consists of JVM, java core liberaries and supportiong files. You need JRE to run java programs/applications. When you download JDK you get JRE along with it. You can download JRE seperately as well.

JVM : JVM stands for Java Virtual Machine. Its a virtual machine that converts java bytecode into machine language and executes it. Java Virtual machine gets created when you run a java program. All java programs/application run within JVM. It is JVM that makes java platform independent.

When we say java is platform independent, it means a java program can be written and compiled at one platform or OS (say windows) and then same code can be executed at any other platform like windows, unix, solaris etc. In other terms this is also called 'write once, run anywhere'.
Its JVM (and bytecode) that makes java plateform independent. You write a java program and compile it to generate .class file. The .class file contains bytecode. This bytecode can now be executed at any platform with the help of corresponding JVM.
Note: There is seperate JVM for each platform. The JVM for unix will convert bytecode into unix machine code while the JVM for windows will convert same bytecode into windows machine code.
No, JVM itself is platform dependent, which means there is a seperate JVM for each environment. Once you have JVM for a platform, any java program can be executed on that platform.
public static void main(String args[]){}
Since main method is invoked by JVM it must have same signature. Otherwise JVM will throw NoSuchMethodFound exception.
Yes, main method can be overloaded.
But atleast one main method with standard signature must be there in order for program to get executed. And JVM will invoke this standard main method only.
Path and Classpath are operating system level environment variales.
Path is used by operating system to define where the system can find the executables(.exe) files. In order to compile your java program you need to set Path to bin folder of your jdk.
Classpath is java specific and is used to specify the location of .class files. To compile the java program you need to set the classpath to the folder that contains .class file of that program, if it is not in current folder.
Java is Object Oriented language, its key features/benefits are mentioned below:

Platform independent

This is probably most important feature of Java. It means you can write/compile java program at any platform and run it at any other platform.

Security

Java's security model is certainly better than other alternatives. .

Robust

Robust means reliability. Java is very good in early checking for possible errors, as Java compilers are able to detect many problems that would first show up during execution time in other languages. It follows strict type checking.

Internationalization

Java supports internationalization that means the same Java application can support multiple languages (English, Japanese, Chinese etc.)

Programmers efficiency and Time to market

Java is an elegant language combined with a powerful and well-designed set of APIs. That means you don't have to start evertying from scratch. There is already a lot of things done you just have to reuse it and implement your business logic.
In java JAR stands for Java ARchieve. So a jar file is a java archieve file, containing classes.
No, Java is not a pure or completely object oriented language as it uses primitive data types which are not objects.



<< Previous Page : 1 2 3 4 5 6 7 8 Next >>