Java Primitives

There are 8: boolean, byte, char, short, int, long, float and double.

5 flashcards · Programming Languages · by lakesare

  1. There are 8 primitive data types. Into what 4 groups can they be subdivided?

    4 integer: byte, short, int, long. 2 floating-point: float, double. char, boolean.

  2. Name 4 integer data types in Java and their sizes.

    byte - 8-bit short - 16-bit int - 32-bit long - 64-bit All are signed integers.

  3. What are the min and max values of byte rrr = 15; ?

    byte can take up to 8 bit, therefore it can take up to 28 values. 256/2 = 128. min: -128, max: 127 (considering 0).

  4. By default Java thinks 15.54 is a?

    double. To designate it as float, use 15.54f.

  5. How to indicate a signed number in Java?

    All numbers are signed in Java, Java doesn't support unsigned data types. C supports signed (the default) and unsigned numbers. Java supports only signed numbers.