Top 25 Java Quiz Questions – A Small Test to Build Your Knowledge

Free Java courses with 37 real-time projects - Learn Java

Till now, you gained the complete knowledge of Java programming language. So, be ready to test your knowledge with this “Java quiz questions”.

Here, we are providing you with some multiple choice questions of Java with answers. This java quiz will help you to brush up Java concepts.

Do not forget to check other java quizzes as well from the series of 7 Java Quizzes.

So let’s start the quiz!!!


Here we come to the end of the Java Quiz. Hope you enjoyed the quiz!!!

Do share your feedback and score in the comments section.

Did you like this article? If Yes, please give DataFlair 5 Stars on Google

follow dataflair on YouTube

25 Responses

  1. Akila T says:

    I’m not getting my score. Help please.

    • DataFlair Team says:

      Hi Akila,
      Thanks for taking this Java Quiz. We have checked the Quiz and all its settings, everything is working fine. Please ensure you filled all the answers (mandatory), and after submitting your email id, you will get your score on the screen with the answers you have provided.

  2. Ajith says:

    is that the 14th question’s answer is correct? can you explain to me why?

  3. ancy says:

    can you explain how did you get the answer to the 14th question?

  4. Bhuvaneswari says:

    in that program they have cleared thelist in the 4th line list clear()
    so the actuall initial values are totally washed out then the further values are that the size is 2 i guess

  5. sanjay.b says:

    nice skills to build our knowledge

  6. Aka Ace says:

    4th question : Answer is Runtime exception

  7. anil says:

    Answer for problem 4 is incorrect

  8. Swarna Sukanta says:

    Please let me know the answer of question no 21.

  9. Vishal says:

    consider one question as 1 marks

  10. R.kalpana says:


  11. Janice M. Garcia says:

    Most application software programmer will not need to use the to see if they are equal, especially with Strings. You use equal() with Strings. compareTo() =0 does not imply equality in all cases!!! The only time to use this would be for creating a Dictionary of words sorted in ascending order. A

  12. nabita waluka says:

    Hi, i am happy with our quiz questions and everything works well. its very helpful but i suggest that you and an explanations to the correct answers for many learners like me to understand fully.
    i thank you

  13. Zikrillo Islomov says:

    output will be different it is incorrect

  14. sadak abdulle says:

    sadak abdullahi rage I want more quiz of java

  15. Chaitra says:

    10th Answer look like
    5{null=null, 2=ayushi, 7= renuka, 9…., 11…}

  16. Bongani Mguni says:

    for question 4 its compile exception because the java generics are not covariant meaning evn if integers is a subtype of numbers its does not mean list type integers is a subtype of list type

  17. Phumelele Miya says:

    Awesomeness 👌

  18. Phumelele Miya says:

    Already passed

  19. sureshreddy mallakuntla says:

    is that the 4th question answer is correct? can you explain to me How.

  20. Gozde Apak says:

    2th question : [1,3,2]

  21. preksha bhalani says:

    16. Question
    What will be the output of the following code
    class PrintValue
    void display(t obj[])
    for(t i:obj)
    System.out.println(i+” “);
    public class MyClass {
    public static void main(String…args)
    Abc obj1=new Abc();

    Integer i[]= {1,2};

    Double d[]= {1.1,2.2};

    It should give the error because of the class name PrintValue and we are calling Abc

Leave a Reply

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