Core Java Interview Questions with Answer

Spread the love

If you are looking for a Software Development Jobs In Java. You need to have a good understanding of fundamental or Core java Concepts. The interviewer wants to know if the candidate has a basic concept clear or not.

In this situation, you can take the help of popular Core Java Interview Questions to make your journey easy as a software developer.

If you have prepared core Java or any programing language it is very difficult to remember each and everything. It is very much possible for you to confuse some core concepts. If the Interviewer anyhow knows your weakness then he will take advantage of your weakness and destroy all your game plan.

What interviewer will ask any one can’t predict. Some time intervewer also taking help from website or blog for asking Core Java Interview Questions

It may be posible Interviewr and candidate may read same website or blog, this is make the big chanse for candidate.

I am going to cover some popular Core Java Interview Questions which will set your way to go the interview process. You can check Core Java Syllabus also.

Java is a very popular programming language and used by approx 10 Million software developers worldwide to develop applications. Currently, Aprox 16 Billion devices supporting Java.

Java is also used to create applications for brand new technologies like Big Data to household devices like Mobiles and DTH boxes. that’s why Java is used everywhere!. That’s why Java Certification is the most in-demand certification in the programming domain.

One small request to you, If there is any core Java interview question that has been asked to you, please comment below so that we can add acordingly

Pro Tip:

Try to answers the Core Java Interview Questions that are short and to the point.

So now let get start some of the most popular Core Java Interview Questions

Best Core Java Interview Questions List 2021

  1. What is Java?

    Java is a high-level, secure and, robust, Object-Oriented programming language. It is a platform-independent, high-performance, Multithreaded, and portable programming language.

    Java was developed by James Gosling in the year Jun 1991. It is also known as platform-independent because it provides its own JRE and API.

  2. What is JDK (Java Development Kit)

    JDK (Java Development Kit) is Kit that provides the environment to develop and execute(run) the Java program. JDK includes two things
    Development Tools which is required to develop the application. and second JRE (Java Runtime Environment) which is required to execute the application.

    It physically exists. It includes JRE + Development tools. Java Platforms published by Oracle Corporation You can Download Latest JDK using below Links
    Java Download
    Note: JDK is only used by Java Developers.

  3. What is JRE (Java Runtime Environment)

    JRE (Java Runtime Environment) is an installation package that provides a runtime environment to run you already develop code or application only. Not to develop applications or programs. JRE is by default included in JDK. If required you can download JRE separately.

    JRE is only used by those who only want to run the Java Programs i.e. your application user.

  4. JVM (Java Virtual machine)

    JVM (Java Virtual machine) is a part of both JDK and JRE. it is contained or inbuilt in both. Whatever Java program or application you run using JRE or JDK goes into JVM and JVM is accountable for executing the java program line by line.

    JVM is also known as an interpreter. JVM java is called a machine-independent programming language.

    Java Virtual Machine is a virtual machine that empowers the computer to run the Java Code. JVM behaves like a run-time engine which calls the main method present in your Java program.

    JVM is the designation that must be implemented in the machine. The Java program is compiled by JVM and generates a Bytecode that is platform-independent and close to the native language.

  5. What is the platform?

    A platform is the hardware or software environment in which a section of the software is executed. There are two types of platforms, software-based and hardware-based. Java provides a software-based platform.

  6. What is JIT compiler?

    Just-In-Time(JIT) compiler: It is used to enhance performance. JIT compiles parts of the bytecode that have similar functionality at the same time and therefore reduces the amount of time needed for compilation.
    Here the word “compiler” refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a particular CPU.

  7. How many types of memory areas have in JVM?

    These are the memory areas which is allocated by JVM
    Class Area: Class Area also called Method Area that is store stores per-class structures such as the runtime constant pool, field, method data, and the code for java methods.

    The Java heap is the block of memory related to store objects instantiated by applications running on the JVM. Objects in the heap can be shared by the threads. Many Sys Admin restricts the Java heap size to 2 to 8 GB in order to reduce garbage collection pauses.

    Stack: Java Stack saves local variables and incomplete results, and plays a part in method invocation and return. Each thread has a private JVM stack, created at the same time as the thread. A new frame is created each time when a method is invoked. A frame is finished when its method invocation end.

    Program Counter Register: stores the address of the Java virtual machine instruction which is currently being executed.

    Native Method Stack: If you have used any native language code. then this dedicated Native Method Stack used to store that code.

  8. What provides Java its ‘write once and run anywhere’ nature?

    The simple answer is bytecode. Java compiler converts the Java programs into the class file (.class file extension) which is the intermediate code between java source code and machine-executable code. This bytecode is platform-independent which is the reason and can write code once and execute on any platform.

  9. What is classloader?

    Classloader is a subsystem of JVM, which simply loads class files in JVM. When java starts execution of a class then the first step is loading that class into JVM with the help of the classloader.
    In Java, there are three built-in classloaders in Java.

    Bootstrap ClassLoader: This is the first classloader. Java has all the basic and necessary class packs into one file are called rt.jar it is contains packages like java.lang, java.net, java.util, java.sql and java.io etc. Bootstrap ClassLoader first loads the rt.jar 

    Extension ClassLoader: This is the child classloader of Bootstrap. at the same time, it is the parent class loader of the system classloader. It loads the jar files in your java home directory “jre/lib/ext” .

    System/Application ClassLoader: This is the child classloader of the Extension classloader. It loads the class files from the classpath set by the envirnment. By default, the classpath is set as the current directory. You can modify the classpath using “-cp” or “-classpath” switch. It is also called Application classloader.

  10. Is source file name .java is valied in Java?

    Technically Yes, But don’t use it like this, in Java we can save our java file by .java only, we can compile it by javac .java and execute by java and class name 
    example:
    //savefile as .java only  
    class Test {  
    public static void main(String args[]) {  
    System.out.println(“Hello Test .java file name”);  
    }  
    }  
    //compile by javac .java  
    //execute by     java Test  

  11. What if I write static public void rather public static void ?

    There will be no problem. Your code will compile and execute perfectly because the order of specifiers doesn’t matter in Java.

  12. What is the default value of the local variables?

    The local variables initialize by default, neither primitives nor object references. only member variable of a class has default values.

  13. What is use of static keyword in Java?

    There is 3 different use of static keyword in java, these are static methods, static variables, and static block

    1. The static methods defined as static are shared among all the objects of the class. Actually, we don’t need to create an object to access the static method. The static is the part of the class and not of the object.

    2. The static variables are stored in the class area, and we do not need to create an object to access such variables. Therefore, static is used in the case, where we need to define variables or methods which are common to all the objects of the class.

    3. The static block is used to execute blocks only once in a Class lifetime.


Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top