Most Frequently asked Interview Questions and Answar in Java:
In this Java Interview Question blog, we have covered almost 25+ important core Java interview questions and answar for freshers and experienced candidates.This post on JAVA Interview Questions and Answars is prepared to help you understand the basic concepts of Java programming for top compnyes interview purposes. All the most important JAVA concepts are explained here with examples for your easy understanding. Like diffrence between and details about JDK, JRE, JVM or some bacis which you know before going and interview.
This blog covers core JAVA topics, advance java topics and also industry level project related most important Interview Questions with examples to make you get ready perfectly to face any JAVA interview confidently.
basic Java Interview Question and Answer,
OOPs concepts Interview Question and Answer,
Collections Interview Question and Answer,
Exception Handling Interview Question and Answer,
Multi-threading Interview Question and Answer,
Serialization and Deserialization Interview Question and Answer,
Keywords Interview Questions and Answer --------- Static keyword and Final Keyword
Most Popular Java Interview Questions:
Given below is a comprehensive list of most important and commonly asked basic and advanced Java programming interview questions with detailed answers.1. What is the difference between JDK and JRE?
JDK stands for Java Development Kit. It contains the tools or libraries for development of Java programs. It also contain compilers and debuggers needed to compile Java program, JRE stands for Java Runtime Environment. This is included in JDK. JRE provide libraries and Java Virtual Machine ( JVM ) that is required to run a Java program.2. What is Java Virtual Machine (JVM) explain?
Java Virtual Machine ( JVM ) is an abstract machine that executes Java Byte code. There are different Java Virtual Machine ( JVM ) use for different hardware and software platforms. So Java Virtual Machine ( JVM ) is platform dependent. Java Virtual Machine ( JVM ) is responsible for loading, verifying and executing the Byte code on a platform.3. What are the different type of memory areas allocated by JVM?
In java, Java Virtual Machine ( JVM ) allocate memory to different processes, methods and objects. Some of the memory areas allocated by JVM are:1. ClassLoader: It is a component of JVM used to load the class files.
2. Class (Method) Area: It stores per-class structures such as the runtime constant pool, field, method data, and the code for methods.
3. Heap: Heap is created at runtime and it contains the runtime data area in which objects are allocated.
4. Stack: Stack store local variables and partial results at runtime. It also helps in method invocation and return value. Each thread creates a private JVM stack at the same time of thread creation.
5. Program Counter Register: This memory area contain the address of the Java virtual machine instruction that is currently being executed.
6. Native Method Stack: This area is reserved for all the native methods used in the java application.
4. What is JIT compiler?
Just In Time compiler also known JIT compiler is used for performance improvement in Java. It is enabled by default. It is compilation done at execution time rather than earlier. Java has popularized after the use of JIT compiler by including it in JVM.5. How Java platform is different from other platforms?
Java is a platform independent language. Java compiler convert Java code in to byte code that can be interpreted by JVM. There are JVM written for almost all the popular hardware and platforms in the world.Java byte code can run on any platform in same way. Where as other languages require libraries compiled for a specific platform to run code.
6. Why people say that Java is 'write once and run anywhere' type language?
You can write Java code on Windows and compile in Windows platform. The class and jar files that you get from Windows platform and you can run on Unix environment also. So it is a truly platform independent language.Behind all this portability is Java byte code. Byte code generated by Java compiler can be interpreted with any JVM. So it becomes much easier to write program in Java and expect those to run on any platform. Java compiler javac compiles java code and JVM runs that code.
7. How does ClassLoader work in Java?
In Java, ClassLoader is a class that is used to load class files in JVM. ClassLoader loads files from their physical file locations e.g. Filesystem, Network location etc. There are three main types of ClassLoaders in Java.1. Bootstrap ClassLoader: This is the first ClassLoader. It loads classes from rt.jar file.
2. Extension ClassLoader: It loads class files from jre/lib/ext location.
3. Application ClassLoader: This ClassLoader depends on CLASSPATH to find location of the class files. If you specify your jar in CLASSPATH, then this ClassLoader will load them.
Comments
AWS Online Training