QUESTIONS & ANSWERS
JAVA
Is String a class or data type in JAVA ?
In Java, String
is considered a class rather than a primitive data type.
Java has eight primitive data types, which are byte
, short
, int
, long
, float
, double
, char
, and boolean
. These primitive data types are built into the language and are used to represent basic values.
In contrast, String
is a class that represents a sequence of characters. It provides methods for manipulating and comparing strings, and it is used extensively in Java programming for tasks such as input/output operations, text processing, and formatting.
So, to summarize, in Java, String
is a class that represents a sequence of characters, whereas primitive data types are the most basic types of data that the language can understand.