Latest Qualification Jobs


ENTER YOUR E-MAIL FOR FREE JOB ALERTS RIGHT INTO YOUR INBOX -
AFTER THIS, YOU WILL NOT MISS ANY GOVT/PVT VACANCY
Check Your Email To Activate the Confirmation Link

Top 30 Java Interview Questions & Answers for 2018 (Freshers/Experienced)

Java Interview Questions

Java refers to general-purpose computer-programming language originally developed by James Gosling. Here we are listing Top 30 Java Interview Questions & Answers which will guide freshers as well as experienced ones too.

Java is easy to write, compile, debug & learn. Those preparing for Interview session may refer Top 30 Java Interview Questions & Answers for 2018 from here. These are among the important Java Interview questions provided on below of page.

Java Interview Questions & Answers:

Java is among the most popular programming languages used for creating Web applications and platform. With the help of this, developers write code that would run on any machine despite of its architecture or platform.

To fetch more stuff regarding Java Interview Questions & Answers, you may go through this page created by team members of recruitmentresult.com. Go through all Interview Questions of Java for your best preparation.

Read Here: Java Interview Experience

Java Interview Questions

Ques 1: What is JVM?

Ans: JVM is an acronym for Java Virtual Machine, it is an abstract machine which offers the runtime environment in which java bytecode can be executed. JVMs are aceesible for many hardware and software platforms

Ques 2: How many types of memory areas are allocated by JVM?

Ans: Following memory areas are allocated by JVM.

  • Class(Method) Area
  • Heap
  • Stack
  • Program Counter Register
  • Native Method Stack

Ques 3: What will happen if I write static public void in place of public static void?

Ans: Program will compile and runs properly.

Check Out: Java Programming Interview Questions

Ques 4: What is constructor?

Ans: Constructor is like a method that is put to use for initializing the state of an object. It is invoked at the time of object creation.

Ques 5: Does constructor return any value?

Ans: Yes, constructor returns any value which is current instance

Ques 6: What is static block?

Ans: Static Block is used for initializing the static data member. It is excuted prior main method at the time of classloading.

Ques 7: What is composition?

Ans: Composition refers to holding the reference of the other class within some other class.

Get Here: Java Programming Questions and Answers

Ques 8: Can you use this() and super() both in a constructor?

Ans: No. Because super() or this() must be the first statement.

Ques 9:  Can we override static method?

Ans: No, you can’t override the static method due to the fact that they are the part of class not object.

Ques 10: Can you have virtual functions in Java?

Ans: Yes, all functions in Java are virtual by default.

Ques 11: Is constructor inherited?

Ans: No, constructor is not inherited.

Also Check: Top 50 Advanced Java Interview Questions

Ques 12: What is object cloning?

Ans: The object cloning is put to use for creating the exact copy of an object.

Ques 13:  What is javac ?

Ans: It is used for producing java byte code from *.java file. It is the intermediate representation of your source code that contains instructions.

Ques 14: State Different Data types in Java.

Ans: Following are various data types in Java.

  • byte – 8 bit (are esp. useful when working with a stream of data from a network or a file).
  • short – 16 bit
  • char – 16 bit Unicode
  • int – 32 bit (whole number)
  • float – 32 bit (real number)
  • long – 64 bit (Single precision)
  • double – 64 bit (double precision)

Ques 15: What are Literals?

Ans: A literal is a value assigned to a primitive or string variable or passed as an argument to a method.

Find Here: Core Java Interview Questions and Answers

Ques 16: Define Arrays.

Ans: An array refers to group of fixed number of same type values.

Ques 17: Give main principles of OOPS language?

  • Inheritance
  • Polymorphism
  • Data Encapsulation
  • Abstraction

Ques 18: Does Java support operator overloading?

Ans: No, Operator overloading is not supported in Java.

Ques 19: Is it possible to overload main () method of a class?
Ans: Yes, we can overload main () method as well.

Ques 20: Can this keyword be assigned null value?
Ans: No, this keyword cannot have null values assigned to it.

How to Answer? Confusing Interview Questions

Ques 21:  State the methods of creating thread in java?

Ans: There are two ways of creating a thread.

  • By Implementing Runnable interface.
    By Extending Thread class.

Ques 22: Define Set?

Ans: Set is a Collection that cannot contain duplicate elements.

Ques 23: What is Access Modifier?

Ans: Java offers access modifiers to set access levels for classes, variables, methods as wel as constructors.

Ques 24: What is an Exception?

Ans: An exception is a problem which takes place during the execution of a program. Exceptions are caught by handlers positioned.

You may Read This: Interview Questions and Answers

Ques 25: What is Abstraction?

Ans: Abstraction refers to the capability for making class abstract in OOP. It guides in reducing complexity and helpful for maintainability of the system too.

Ques 26: Why Packages are used?

Ans: Packages are used in Java due to following reasons.

  • For preventing naming conflicts
  • To control access
  • For making searching/locating and usage of classes

Ques 27: What is an applet?

Ans: An applet is a Java program that runs in a Web browser.An applet refers to fully functional Java application due to the reason it is having entire Java API at its disposal.

Ques 28: What do you mean by TreeSet?

Ans: TreeSet simply refers to a set implemented for getting elements in a sorted order.

Do You Know: How to Impress the Interviewer in 60 Seconds

Ques 29: Define JIT compiler?

Ans: JIT compiler is used for improving runtime performance of computer programs based on bytecode.

Ques 30: Define composition?

Ans: Composition refers to holding the reference of the other class within some other class.

Note:

Hope, you get all details about Top 30 Java Interview Questions & Answers for 2018. Keep visiting our portal from time to time for receiving more updates concerning latest notice about jobs & others.

Something That You Should Put An Eye On

Java Developer SalaryCore Java Syllabus
Core Java QuizJava Online Test
Vacancies For Java FreshersAdvanced Java Syllabus
Interview Preparation TipsCommon Interview Mistakes

Filed in: Interview Tags: 

Leave a Reply

Submit Comment