Java Inteview Question (Medium)

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which keyword in Java is used to point to the current instance of a method or a constructor?

  • object
  • this (correct)
  • super
  • instance

What is the method of calling one constructor of a class using another constructor of the same class called?

  • Constructor chaining (correct)
  • Method overloading
  • Method overriding
  • Inheritance

What is the actual superclass of all the classes in Java?

  • Object class (correct)
  • Base class
  • Parent class
  • Super class

Why are pointers not supported in Java?

<p>To achieve security by abstraction (A)</p> Signup and view all the answers

Which type of inheritance involves multiple child classes inheriting properties from multiple parent classes?

<p>Multi-level inheritance (B)</p> Signup and view all the answers

What is the term for creating and implementing a method with the same name in a subclass as the parent class?

<p>Method overriding (C)</p> Signup and view all the answers

What are the limitations of inheritance?

<p>All of the above. (D)</p> Signup and view all the answers

Why does Java not support multiple inheritances?

<p>It creates complexities like the diamond problem. (A)</p> Signup and view all the answers

Which type of constructor is created by the compiler when no constructor is defined in the program?

<p>Default constructor (D)</p> Signup and view all the answers

Can a constructor be invoked by a subclass?

<p>Yes (D)</p> Signup and view all the answers

What is the difference between constructors and methods?

<p>Constructors are invoked when a class is instantiated, while methods are invoked to perform actions on objects (B)</p> Signup and view all the answers

What is the purpose of a wrapper class in Java?

<p>To include primitive data types in the family of objects (A)</p> Signup and view all the answers

Ques.1. What is Java?

<p>Java is a programming language developed in 1995 by Sun Microsystems. (C)</p> Signup and view all the answers

Ques.2. What are some features of Java?

<p>Java can perform various tasks simultaneously. (D)</p> Signup and view all the answers

Ques.3. What is JDK?

<p>JDK includes all the development tools required to develop a program. (B)</p> Signup and view all the answers

Ques.4. What is Javac?

<p>Javac is a compiler used in Java to convert program code into bytecodes. (D)</p> Signup and view all the answers

Which one of the following is true about String objects in Java?

<p>String objects cannot be modified once created (B)</p> Signup and view all the answers

What is the purpose of making String final in Java?

<p>To maintain the immutability of String objects (B)</p> Signup and view all the answers

What is the difference between the == operator and the .equals() method when comparing strings in Java?

<p>The == operator compares memory references, while .equals() compares object values (A)</p> Signup and view all the answers

What is the purpose of inheritance in object-oriented programming?

<p>To acquire properties of a parent class in a child class (D)</p> Signup and view all the answers

Which of the following is true about the JVM?

<p>The JVM is the interpreter for the Java programming language. (C)</p> Signup and view all the answers

Why is Java considered platform-independent?

<p>Java code is compiled into an intermediate language called bytecode. (A)</p> Signup and view all the answers

What is the purpose of the Just In Time (JIT) compiler?

<p>To enhance the performance of the application. (D)</p> Signup and view all the answers

What are the different access modifiers in Java?

<p>Default, Private, Protected, Public (D)</p> Signup and view all the answers

Which method can be declared final?

<p>main() method (C)</p> Signup and view all the answers

Can an interface be declared final?

<p>No (B)</p> Signup and view all the answers

What is static binding?

<p>Identifying classes and objects during compile time (A)</p> Signup and view all the answers

What is dynamic binding?

<p>Identifying classes and objects during run time (A)</p> Signup and view all the answers

What does the instanceof operator do?

<p>Checks if the object is an instance of a specific class or subclass (C)</p> Signup and view all the answers

What is a multithreaded program?

<p>A program that uses multiple threads to execute tasks simultaneously (C)</p> Signup and view all the answers

Flashcards are hidden until you start studying

More Like This

Java Interview Questions
3 questions

Java Interview Questions

DelightedCognition avatar
DelightedCognition
Java Interview Question (Basic)
46 questions
Java Interview Question (Hard)
30 questions
Use Quizgecko on...
Browser
Browser