Core Java Interview Questions

  • By
  • July 5, 2021
  • JAVA
Core Java Interview Questions


Dear Students, in this blog, you will find Core Java Interview Questions from Java Training In Pune,  I am discussing the most commonly occurring Core Java Interview Questions While preparing for interviews one of the most important for students is technical preparation. Sometimes you will get direct questions and sometimes twisted questions so today I will discuss them.

Most Important Core Java Interview Questions

  • What is a platform?

      A platform is an environment where software is running. Java provides a software-based platform.

      Platform can be hardware-based, or software-based.

  • What is byte Code?

Compiled java  Code is known as byte  Code. Byte Code is  also called magic  Code also. It will provide security to java Code.

  • What are the types of data Types in Java?

There are two types of data types Primitives and nonprimitives

Core Java Interview Questions

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

  • What are static variables?

The variables which are declared using static keyword is known as static variables.

  • What is JDK?

JDK is Java Development Kit. It is software for creating and running java programs. Currently jdk16 is running.

  • Why java is Called Write Once Run Anywhere?

Because of Byte Code java is Called write Once Run Anywhere. Because Compiler converts into Byte Code (.Class File).

  •  What is Class Loader?

Class Loader is used to Load the Class. It is a sub System of JVM. When we run a java programs the first thing is class Loader. Three built-in class Loaders in JVM.

Bootstrap Class Loader, Extension Class Loader, System/Application Class Loader.

  •  Can Local Variables have Default Values?

No. Compiler   does not have any default value.

  • What are the Types of Variables in java?

In java, based on Scope of variable. Variables are 3 types 

Local Variable, Instance Variable, Static Variable


Local Variables: The Variables  which are declared inside a method  are  called  Local Variables.

The Scope of  Local Variables  inside a method only.

Instance Variables: The  variables  which are declared  in  a class  are called  instance variables. The Scope of instance Variables  are  you can access    any  where   inside a class. Compiler will replace default value  for instance Variables .

Static Variable: The variables  which  are sharable will  all objects   are  called Static Variables. Static Variables  are declared  using  static keyword.


  • What are Static Methods?

Methods that are declared using static Keywords are static methods. You   can Access only static variables inside a static methods. All   static methods are accessed directly.

  • Can we overload the main method in java?

Yes we can overload  main method  . the compilation start from main only. Because JVM  understands public static void main (String [] args) only.   Main  method  is  entry point  for program.


  • What is method overloading?

In java  method  overloading   is  Same  method name  in  a  class  with  different  types  of  parameters. Method overloading provides   manage ability and read ability. You can use same method name in a class with different types of parameters. For example System.out.println () is overloaded method.

  • Why   does   pointers   are not used   in  java?

Pointers   are  not  safe(unsafe).Pointers   are  complicated  for  beginners . Java focuses  on  Code  Simplicity. So  java  does not use  pointers.


For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

  • What is JIT?


JIT   is   Just  in Time . It  is translator  of source Code  to  machine  executable code.JIT  is  Part  of  JVM.It  will  improvers  the  code performances.  


  •  How   you will  declare  infinite  Loop  in java.

In java    you  can   make  any loop  as  infinite loop 

Using for  loop

  1. For(;;){  // your  Logic}

Using  while Loop




//your Logic







You  can  use  any one of Loop   for  infinite Loop.

In java  there  are  four(4) loops. While loop, for loop, do while loop, enhanced for loop.It  is  also  called for each loop.


  •  What  are  difference  between   for loop  and  enhanced for loop(for each loop)

For each loop   is mainly used   to access the objects   and Arrays. It is very simplified one. Where you can declare variable, no need   for condition and increment / decrement variables. It is used to iterate only arrays and objects only. In for Loop we need to declare variable, writes condition, and write increment, decrement based on logic

Syntax of both Loops

For Loop  Syntax

For(variable_declare; condition; increment/decrement)


// Logic


Enhanced  for loop

For(variable : array/object)


// Logic


For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

Write difference  between  equals()  and (==) in java?

Equals ()  is  a  method   in  Object class  where  (==)  is  binary  operator 

Equals ()  method will check the equality  of  content  of  objects. Where double equals (==) will check the address of the objects.

Simple way equals method for content checking. And double equals for address   checking. 

What   is  constructors   in java?

Constructor  is  a  special  method  that  get  executed   when we create a  objects   of  a class. It  is  used   to  initialized  the  instance  variables. 

 What   are   the  Types  of  constructors  in java?

There  are  two types  of constructors  in  java.1) Default constructor2)Parameterized constructor.

How  to create a  anonymous  object   in  java?

Using new keyword we can create a anonymous object. For example I am creating Student class then in main we can create a anonymous object by writing new Student ();.

what   is  super keyword?

In order to access   the method and  instance   variable    from  parent  class  . Java provides   super keyword. We can use  Super()  method   to access  parent  class  constructor .Super()  method  should  be   written  the   first  line  of  a  code.

what constructor overloading?

Just like method overloading  even we  can  overload constructor .  In  a  class  same class  name  with  different ,  different  types  of  parameters  is  called   constructor   overloading. Java Course In Pune can teach same constructor name with different  types  of parameters.


What   are  access specifiers in java?

Access Specifiers   are  access  ability  of  a  member  variable  or  methods  where   developers  can  decide  which  part  of  a  code can  be  accessed   by  end  user. The  default  access  specifiers    is  default   in  java. Java provides  public, private , protected and default  access  specifier 

How   to create  Arrays   of  Objects  in  java?

We  can create  arrays   of  objects in  java. Because   in java  array  is  objects. For  example

I  am  creating  Student class in main we  can create  Arrays of  objects    like

Student  stobj[] = new Student[3];

After creating  arrays of  object  we can  initialize   like this

stobj[0]=new Student();

stobj[1]=new Student();

stobj[2]=new Student();

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

Core java  classes   in  pune

 What   are Packages   in  java?


Package  is  Collection  of  classes, interfaces,and subpackage. Package  will  provides  the  encapsulation where  all classes   are  Placed  in  one  folder. Package  provides manage ability. Multiple   Packages   can  have  same class name. Package Provides access protection. In java there  are  two  types  of packages  Built in package , user defined Package. Package  is  used  for  easy  maintenance


How to run a package   using command prompt?

Package  can be  run using   command prompt  also . we  can write javac –d  packagename, (this is  for  compilation). To run a package we use   java packagename.classname.


 How to access  the package?

To  access package   we  need  to  import  a  package .For  importing  we need  to  write  import package.*;   Here  package  is  name of the package.

What    is this keyword in java?

This is a keyword in java. In a class if you have   ambiguity between member variable and parameter of a constructor or a method you can use this keyword. This keyword always refers to current class member variables (instance variables).

 How to invoke   a parameterized constructor from   default constructor?

     Using   this ()   method we can call a one constructor   from another constructor. If you want to achieve constructor chaining or reuse of constructor we can use this ().One 


 What are wrapper classes?

        In Object Oriented Programming Language everything  is  an object .So in collection topic it requires  Wrapper classes   convert    primitives to objects and   primitives  to  object So  for  conversion Wrapper classes are   used in java. 


 What    are   the  Uses  of  Wrapper  classes?

The   Uses   of Wrapper  classess   are  

  1.  Wrapper   classes   helps  in  serialization. We  can  convert  primitives  to  Objects using wrapper class.
  2. Mainly in Collection Framework we  are working  with objects. Like  Array List, Linked List,etc are working with wrapper class only.

In java  there  are  8 Wrapper classes. Which converts  object  to  primitives .

For Free, Demo classes Call: 8237077325
Registration Link: Click Here!

 What   is   Auto Boxing?

The   automatic     conversion   of primitives data type     to objects is known as Auto Boxing which happens automatically.

For example 

In a class  we can  write like

Int x=100;

Integer i=Integer.ValueOf(x);

Here  x   is  converted  as  Integer object  i.  Which will happen automatically   is called auto boxing.


 What is final keyword in java?

In order to declare constant in java. We  can  use  a final keyword. Final keyword makes variable as a constant. We  can ‘t  change  its  value. We   can declare variable  as  a final  variable  as a static  variable. One rule   for  final keyword is  we need  to  initialize  it. Un initialized  final  variable  is  known as  blank  final variable. If  we  make  any variable  as   final  its  value  does not  changes. We cannot override final method which will stop inheritance. Ask to the industry experts of Java Classes In Pune for more information by calling them.


Sangam Bhagyashri

Call the Trainer and Book your free demo Class for JAVA now!!!

© Copyright 2021 | SevenMentor Pvt Ltd.


Submit Comment

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