Task 1 of 8 · 0 solved · 8 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

1.3 Types — int, double, boolean

Lesson

Types: int, double, boolean

Every value has a type that decides what it can hold and how it behaves. Three basics: int (whole numbers), double (numbers with a fractional part), and boolean (true/false).


The three basic types

int holds whole numbers: int age = 30;. double holds fractional numbers: double price = 9.99;. boolean holds a logical value: boolean ok = true;.


▶ Try it: run this, then change something and run it again.



Sort each value into the type that best fits it.


Which type holds only true or false?


Match each value to its type.


Which type would you use to store a price like 9.99?


Type exactly what this program prints.

public class Main { public static void main(String[] a){
    boolean ready = false;
    System.out.println(ready);
}}