โ† All 1Z0-819 Flashcard Decks

Java Fundamentals & Object-Oriented Programming Flashcards

7 cards from real 1Z0-819 practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Java Fundamentals & Object-Oriented Programming flashcards as text
  1. Which of the following correctly describes polymorphism in Java?

    Answer: A reference type can behave differently depending on the actual object it points to at runtime

    Polymorphism allows a supertype reference to invoke overridden methods on subtype objects, with the actual behavior determined at runtime.

  2. What is the default value of an instance variable of type `boolean` in Java?

    Answer: false

    Instance variables of type boolean are initialized to false by default when a class is instantiated.

  3. Given `List list = new ArrayList<>(); list.add("x");`, which statement causes a compilation error?

    Answer: list.add(1)

    `list.add(1)` attempts to add an Integer to a List, violating the generic type constraint and causing a compilation error.

  4. Which statement about constructors in Java is correct?

    Answer: Constructors can be overloaded

    Multiple constructors with different parameter lists (overloading) are allowed and commonly used to provide flexible object initialization.

  5. What does the `instanceof` operator return when the left operand's type is a subtype of the right operand?

    Answer: true

    `instanceof` returns true whenever the object on the left is an instance of the class or any of its subtypes on the right.

  6. A Java enum implicitly extends which class?

    Answer: java.lang.Enum

    All Java enums implicitly extend `java.lang.Enum`, which is why they cannot extend any other class.

  7. What is the effect of declaring a method as `static` in an interface (Java 8+)?

    Answer: The method can only be called via the interface name

    Static interface methods are not inherited by implementing classes or sub-interfaces and must be called through the interface type itself.