Latest java Interview Questions and Answers 2024 for Freshers and Experienced

Java: Frequently Asked Interview Questions and answers. Java is a popular, general-purpose programming language that is widely used for developing desktop, web, and mobile applications. It is known for its "write once, run anywhere" philosophy, which allows Java code to be executed on multiple platforms without modification.


Home->Java Interview Questions and Answers

If you're looking for current Java interview questions and answers, you've come to the right place! This Latest 2024 Question List will provide you with a comprehensive list of trending Java interview questions and answers asked in Top Companies interview round.

Java Interview Questions and Answers Play Quiz On Java  |  More Q&A Click Here

# Question Options Answer
301 Which of these are legacy classes?
  • Stack
  • Hashtable
  • Vector
  • All of the mentioned
  • All of the mentioned
    302 Which of these is the interface of legacy?
  • Map
  • Enumeration
  • HashMap
  • Hashtable
  • Enumeration
    303 What is the name of a data member of class Vector which is used to store a number of elements in the vector?
  • length
  • elements
  • elementCount
  • capacity
  • elementCount
    304 Which of these methods is used to add elements in vector at specific location?
  • add()
  • set()
  • AddElement()
  • addElement()
  • addElement()
    305 Which of these class object has an architecture similar to that of array?
  • Bitset
  • Map
  • Hashtable
  • All of the mentioned
  • Bitset
    306 Which of these method is used to make a bit zero specified by the index?
  • put()
  • set()
  • remove()
  • clear()
  • clear()
    307 Which of these method is used to calculate number of bits required to hold the BitSet object?
  • size()
  • length()
  • indexes()
  • numberofBits()
  • length()
    308 Which of these packages contain all the collection classes?
  • java.lang
  • java.util
  • java.net
  • java.awt
  • java.util
    309 Which of these classes is not part of Java’s collection framework?
  • Maps
  • Array
  • Stack
  • Queue
  • Maps
    310 Which of this interface is not a part of Java’s collection framework?
  • List
  • Set
  • SortedMap
  • SortedList
  • SortedList
    311 Which of these methods deletes all the elements from invoking collection?
  • clear()
  • reset()
  • delete()
  • refresh()
  • clear()
    312 What is Collection in Java?
  • A group of objects
  • A group of classes
  • A group of interfaces
  • None of the mentioned
  • A group of objects
    313 Which of these return type of hasNext() method of an iterator?
  • Integer
  • Double
  • Boolean
  • Collections Object
  • Boolean
    314 Which of these methods is used to obtain an iterator to the start of collection?
  • start()
  • begin()
  • iteratorSet()
  • iterator()
  • iterator()
    315 Which of these methods can be used to move to next element in a collection?
  • next()
  • move()
  • shuffle()
  • hasNext()
  • next()
    316 Which of these iterators can be used only with List?
  • Setiterator
  • ListIterator
  • Literator
  • None of the mentioned
  • ListIterator
    317 Which of these is a method of ListIterator used to obtain index of previous element?
  • previous()
  • previousIndex()
  • back()
  • goBack()
  • previousIndex()
    318 Which of these exceptions is thrown by remover() method?
  • IOException
  • SystemException
  • ObjectNotFoundExeception
  • IllegalStateException
  • IllegalStateException
    319 When does Exceptions in Java arises in code sequence?
  • Run Time
  • Compilation Time
  • Can Occur Any Time
  • None of the mentioned
  • Run Time
    320 Which of these keywords is not a part of exception handling?
  • try
  • finally
  • thrown
  • catch
  • thrown
    321 Which of these keywords must be used to monitor for exceptions?
  • try
  • finally
  • throw
  • catch
  • try
    322 Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
  • try
  • finally
  • throw
  • catch
  • catch
    323 Which of these keywords is used to manually throw an exception?
  • try
  • finally
  • throw
  • catch
  • throw
    324 Which of the following keywords is used for throwing exception manually?
  • finally
  • try
  • throw
  • catch
  • throw
    325 Which of the following classes can catch all exceptions which cannot be caught?
  • RuntimeException
  • Error
  • Exception
  • ParentException
  • Error
    326 Which of the following is a super class of all exception type classes?
  • Catchable
  • RuntimeExceptions
  • String
  • Throwable
  • Throwable
    327 Which of the following operators is used to generate instance of an exception which can be thrown using throw?
  • thrown
  • alloc
  • malloc
  • new
  • new
    328 Which of the following keyword is used by calling function to handle exception thrown by called function?
  • throws
  • throw
  • try
  • catch
  • throws
    329 Which of the following handles the exception when a catch is not used?
  • finally
  • throw handler
  • default handler
  • java run time system
  • default handler
    330 Which part of code gets executed whether exception is caught or not?
  • finally
  • try
  • catch
  • throw
  • finally
    331 Which of the following should be true of the object thrown by a thrown statement?
  • Should be assignable to String type
  • Should be assignable to Exception type
  • Should be assignable to Throwable type
  • Should be assignable to Error type
  • Should be assignable to Throwable type
    332 Which of these is a super class of all exceptional type classes?
  • String
  • RuntimeExceptions
  • Throwable
  • Cacheable
  • Throwable
    333 Which of these class is related to all the exceptions that can be caught by using catch?
  • Error
  • Exception
  • Runtime Exception
  • All of the mentioned
  • Exception
    334 Which of these class is related to all the exceptions that cannot be caught?
  • Error
  • Exception
  • RuntimeExecption
  • All of the mentioned
  • Error
    335 Which of these handles the exception when no catch is used?
  • Default handler
  • finally
  • throw handler
  • Java run time system
  • Default handler
    336 What exception thrown by parseInt() method?
  • ArithmeticException
  • ClassNotFoundException
  • NullPointerException
  • NumberFormatException
  • NumberFormatException
    337 Which of these keywords is used to generate an exception explicitly?
  • try
  • finally
  • throw
  • catch
  • throw
    338 Which of these class is related to all the exceptions that are explicitly thrown?
  • Error
  • Exception
  • Throwable
  • Throw
  • Throwable
    339 Which of these operator is used to generate an instance of an exception than can be thrown by using throw?
  • new
  • malloc
  • alloc
  • thrown
  • new
    340 Which of these keywords is used to by the calling function to guard against the exception that is thrown by called function?
  • try
  • throw
  • throws
  • catch
  • throws
    341 Which of these clause will be executed even if no exceptions are found?
  • throws
  • finally
  • throw
  • catch
  • finally
    342 A single try block must be followed by which of these?
  • finally
  • catch
  • finally & catch
  • none of the mentioned
  • finally & catch
    343 Which of these exceptions handles the divide by zero error?
  • Arithmetic Exception
  • Math Exception
  • Illegal Access Exception
  • illegal Exception
  • Arithmetic Exception
    344 Which of these exceptions will occur if we try to access the index of an array beyond its length?
  • ArithmeticException
  • ArrayException
  • ArrayIndexException
  • ArrayIndexOutOfBoundsException
  • ArrayIndexOutOfBoundsException
    345 Which of these classes is used to define exceptions?
  • Exception
  • Throwable
  • Abstract
  • System
  • Exception
    346 Which of these methods return description of an exception?
  • getException()
  • getMessage()
  • obtainDescription()
  • obtainException()
  • getMessage()
    347 What is the use of try & catch?
  • It allows us to manually handle the exception
  • It allows to fix errors
  • It prevents automatic terminating of the program in cases when an exception occurs
  • All of the mentioned
  • All of the mentioned
    348 Which of these keywords are used for generating an exception manually?
  • try
  • catch
  • throw
  • check
  • throw
    349 Which of these statements is incorrect?
  • try block need not to be followed by catch block
  • try block can be followed by finally block instead of catch block
  • try can be followed by both catch and finally block
  • try need not to be followed by anything
  • try need not to be followed by anything

    Are you preparing for a Java developer interview? Brush up on your skills with our comprehensive collection of Java interview questions. Covering everything from basic syntax to advanced concepts, our questions will help you demonstrate your knowledge and experience with the Java programming language.This page is designed to test a candidate's understanding of the key concepts in the Java programming language and their ability to apply that knowledge to real-world situations. Get ready to impress your interviewer and land your dream job with our Java interview question page

    This page provides a comprehensive collection of Java questions and answers, covering a wide range of topics related to the language, such as:

    • Basic syntax and data types
    • Object-oriented programming concepts
    • Control structures, such as loops and conditions
    • Exception handling
    • Collections and generics
    • Multithreading and concurrency
    • Advanced topics such as functional programming and design patterns

    Additionally, you will also find useful tips on how to prepare for your Java interview, such as reviewing your coding skills, studying up on the latest technologies and trends, and practicing your interviewing skills.

    Whether you are a junior developer or an experienced professional, this guide will help you ace your Java interview and land your dream job. So, whether you are looking for your first job as a developer or looking to make a change in your career, this guide will be a valuable resource for you.