Primitive Types

Java has most of the same basic primitive types as C and C++ (int, short, long, float, double, and char), but Java adds the types byte and boolean. The Java type boolean corresponds to the C++ type bool. Java has no type named long double. Unless using the primitive data types introduced in C++11, in Java the size, in bytes, of a value for some specific primitive type is fully specified and is not implementation dependent. See Chapter 2 for details.

Strings

Unlike some versions of C and C++, in Java strings are not special kinds of arrays of characters. Java has a class String that serves as a predefined type. String is somewhat similar to the class string in recent versions of C++. (Coverage of the String class starts in Chapter ...

Get Java: An Introduction to Problem Solving and Programming, 8th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.