โ† All 1Z0-811 Flashcard Decks

Java Language Fundamentals Flashcards

7 cards from real 1Z0-811 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 Language Fundamentals flashcards as text
  1. What is the result of compiling and running the following code? int x = 5; System.out.println(x++ + ++x);

    Answer: 12

    x++ returns 5 (then x becomes 6), ++x increments to 7 and returns 7, so 5+7=12.

  2. Which of the following is a valid declaration of a multi-dimensional array in Java?

    Answer: int[][] arr = new int[3][3];

    int[][] arr = new int[3][3]; is the standard Java syntax for a 2D array declaration and initialization.

  3. Which keyword is used to prevent a variable from being reassigned after initialization?

    Answer: final

    The 'final' keyword prevents reassignment of a variable once it has been initialized.

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

    Answer: false

    Instance variables of type boolean are automatically initialized to false if not explicitly set.

  5. Which of the following correctly describes operator precedence between * and +?

    Answer: * has higher precedence than +

    Multiplication (*) has higher precedence than addition (+), so 2+3*4 evaluates to 14, not 20.

  6. What does the following code print? String s = "Hello"; s.concat(" World"); System.out.println(s);

    Answer: Hello

    Strings are immutable in Java; concat() returns a new String but the original reference 's' is unchanged.

  7. Which of the following is NOT a valid identifier in Java?

    Answer: 2ndItem

    Java identifiers cannot begin with a digit; '2ndItem' is invalid because it starts with '2'.