Skills101
← All practice quizzes

Quiz: Java Data Types

5 questionsNo time limitPass: 60%+10 XP on first pass

Java's 8 primitive types, declaring variables, type casting (widening and narrowing), integer division, overflow, wrapper classes and autoboxing.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    public class Main {
        public static void main(String[] args) {
            System.out.println(10 / 4);
        }
    }
    
  2. Question 2

    What does this print?

    public class Main {
        public static void main(String[] args) {
            double d = 9.99;
            System.out.println((int) d);
        }
    }
    
  3. Question 3

    Which line does NOT compile?

  4. Question 4

    What does this print?

    public class Main {
        public static void main(String[] args) {
            char c = 'a';
            System.out.println(c + 1);
        }
    }
    
  5. Question 5

    Which converts the String "42" into an int?