Scratch for Java

Field (variable)

A field is a variable at the top of a class. Every object of the class has its own copy, so it is like a Scratch variable for this sprite only:

private int score = 0;

The type comes first: int for whole numbers, double for decimals, String for text, boolean for true or false.

Field (variable)

Create Shareable URL

Select Sections