Friday, 22 March 2013

Core Java Interview Question - 1

Question: Is Java is a pure Object Oriented Language?
Answer: Java is a OOPS language and it is not a pure Object Based Programming Language.
Many languages are Object Oriented. There are six qualities to be satisfied for a programming language to be pure Object Oriented. They are:

1. Encapsulation/Data Hiding
2. Inheritance
3. Polymorphism
4. All predefined types are objects
5. All operations are performed by sending messages to objects
6. All user defined types are objects.

JAVA is not because it supports Primitive data type such as int, byte, long... etc, to be used, which are not objects and jvm does not treat these primitive data type as an object. We can convert primitive to object but we can also use primitive data types in our program....if java gives us restriction to write primitive data type that time we can say that java is a pure object oriented language.

Question: What do you mean by platform independence?
Answer: Platform independence means that we can write and compile the java code in one platform (e.g. Windows) and can execute the class in any other supported platform e.g. (Linux, Solaris, etc.).

Question: What is JVM?
Answer: A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled 
Java binary code (called byte code) for a computer's processor (or "hardware platform") so that it can perform a Java program's instructions. Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible because it is aware of the specific instruction lengths and other particularities of the platform.
The Java Virtual Machine Specification defines an abstract -- rather than a real -- machine or processor. The Specification specifies an instruction set, a set of 
registers, a stack, a "garbage heap," and a method area. Once a Java virtual machine has been implemented for a given platform, any Java program (which, after compilation, is called byte code) can run on that platform. A Java virtual machine can either interpret the byte code one instruction at a time (mapping it to a real processor instruction) or the byte code can be compiled further for the real processor using what is called a just-in-time compiler.

Question: What is JRE?
Answer: It is used to provide runtime environment. it is the implementation of JVM. It physically exists. It contains set of libraries plus other files that JVM uses at runtime. Implementations of JVMs are also actively released by other companies besides oracle.

Question: What is JDK?
Answer: JDK or the Java Development Kit is a set of a Java compiler, a Java interpreter, developer tools, Java API libraries, documentation which can be used by Java developers to develop Java-based applications.

Question: What is JIT Compiler?
Answer: A just-in-time (JIT) compiler is a program that turns Java 
byte code (a program that contains instructions that must be interpreted) into instructions that can be sent directly to the processor. After you've written a Java program, the source language statements are compiled by the Java compiler into byte code rather than into code that contains instructions that match a particular hardware platform's processor (for example, an Intel Pentium microprocessor or an IBM System/390 processor). The byte code is platform-independent code that can be sent to any platform and run on that platform.

Question: What gives Java its "write once and run anywhere" nature?
Answer: The byte code. Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platform specific and hence can be fed to any platform.

Question: What is the use of bin and lib in JDK?
Answer: Bin contains all tools such as javac, applet viewer, awt tool etc., whereas Lib contains all packages and variables.


  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.

  2. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

    Java Training in Electronic city

  3. Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us.

    Best AWS Training in Chennai | Amazon Web Services Training in Chennai

  4. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    python training in velachery | python training institute in chennai

  5. The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
    Devops Training courses
    Devops Training in Bangalore
    Best Devops Training in pune
    Devops interview questions and answers

  6. I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thx again!
    Java training in Marathahalli | Java training in Btm layout

  7. This is a good post. This post give truly quality information. I’m definitely going to look into it. Really very useful tips are provided here. thank you so much. Keep up the good works.
    Data Science training in rajaji nagar | Data Science with Python training in chenni

    Data Science training in electronic city | Data Science training in USA

    Data science training in pune | Data science training in kalyan nagar

  8. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa interview questions and answers
    automation anywhere interview questions and answers
    blueprism interview questions and answers
    uipath interview questions and answers
    rpa training in chennai



Thanks for coming here. I hope this information helps you for preparing Java Interview.

Sachin Singh