Examveda
Examveda

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

A. int

B. byte

C. char

D. string

Answer: Option D

Solution(By Examveda Team)

The correct answer is Option D: string.

In Java, a primitive data type is a basic data type that represents a single value. The primitive data types in Java are int, byte, and char among the options provided.

Here's the breakdown:

Option A: int - This is a primitive data type in Java used for representing whole numbers (integers).

Option B: byte - This is also a primitive data type in Java used for representing small integers.

Option C: char - This is a primitive data type in Java used for representing single characters.

Option D: string - This is not a primitive data type in Java. Instead, it is a class (String class) used to represent sequences of characters. String objects are not primitives because they are more complex and can have methods and properties.

So, among the provided options, string is not a primitive data type in Java.

This Question Belongs to Java Program >> Data Types And Variables

Join The Discussion

Related Questions on Data Types and Variables