Java Inteview Question (Medium)
30 Questions
0 Views

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</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</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</p> Signup and view all the answers

    What are the limitations of inheritance?

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

    Why does Java not support multiple inheritances?

    <p>It creates complexities like the diamond problem.</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</p> Signup and view all the answers

    Can a constructor be invoked by a subclass?

    <p>Yes</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</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</p> Signup and view all the answers

    Ques.1. What is Java?

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

    Ques.2. What are some features of Java?

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

    Ques.3. What is JDK?

    <p>JDK includes all the development tools required to develop a program.</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.</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</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</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</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</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.</p> Signup and view all the answers

    Why is Java considered platform-independent?

    <p>Java code is compiled into an intermediate language called bytecode.</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.</p> Signup and view all the answers

    What are the different access modifiers in Java?

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

    Which method can be declared final?

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

    Can an interface be declared final?

    <p>No</p> Signup and view all the answers

    What is static binding?

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

    What is dynamic binding?

    <p>Identifying classes and objects during run time</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</p> Signup and view all the answers

    What is a multithreaded program?

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

    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