Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What Java feature allows for specifying the type in a class?

  1. Inheritance

  2. Generics

  3. Polymorphism

  4. Encapsulation

The correct answer is: Generics

Generics is the correct answer as it allows for specifying the type in a class. Inheritance, polymorphism, and encapsulation are all fundamental concepts in Java, but they do not involve explicitly specifying the type in a class. Inheritance allows for one class to inherit properties and methods from a parent class, polymorphism allows for objects to take on different forms and behaviors, and encapsulation is the practice of hiding data within a class and only allowing access to it through methods.