J3: Variables

Video

Variables are data items that can store many different types of value including text, numbers, booleans, and even whole lists.

Make sure to like and subscribe!

Syntax

In Java, there are many types of variables. These include but are not limited to Strings (text), ints (integers), booleans (true/false, 0/1), Arrays (lists of variables), and more. In this lesson, we are covering Strings, ints, and booleans.

The syntax for a String (a single line of text) is as follows:

String name = ("text");

An int is an integer. Please note that its minimum and maximum values are -2147483648 and 2147483647 respectively. Below is the syntax:

int x = 128;

A boolean is a true or false variable. Here is its syntax:

boolean isWebsiteWorking = true;