Java · Question 16 · Easy

Which of the following is NOT a primitive data type in Java?

  1. String
  2. boolean
  3. int
  4. char
Answer and explanation

Answer: A. String

Explanation: Java has eight primitive types (byte, short, int, long, float, double, char, boolean). String is a class in java.lang, so String values are objects.

Previous: What will be the output of the following Java program? · Next: What is the size of the int data type in Java, regardless of the platform?

Practise java

Try a fresh set of java questions with an explanation after every answer, free and without signing up: Java practice. Or sit a full placement mock test.

More java questions

More technical & programming practice

Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge