Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

DE Deutsche Version

A variable is a placeholder for a value. Variables Variables are used for storing values. In Java, variables need to be defined with a data-type, to define its storage space requirements. The name of the variable must start with a letter, but it may contain numbers within the name. In processing, variable names are case-sensitive.

...

Code Block
// variable Declaration 
int x1 = 15; // an integer i.e a whole number 
float valF = 0.323; // a floating point number i.e a numbers with a decimal point
boolean bFlag = false; // a true or false value i.e a single bit value
String message = "hallo 1"; // a collection of characters 
char character = 'g'; // a siglesingle character. Note the different quotation marks
 
String msg1 = new String("hallo 2");
 
println(x1);
println(valF);
println(bFlag);
println(message);
println(character);
println(msg1);

...

Each kind of variable (it's data type) has an allocated amount of memory, which is enough to store a particular range of values. 

TypeBytesValue range
byte1 byte-128 to 127
short2 byte-32,768 to 32,767
int4 byte-2^31 to 2^31-1
long8 byte-2^63 to 2^63-1
float4 byte-3.4e38 to 3.4e38
double8 byte-1.7e308 to 1.7e308
boolean1 bit true or false
char2 byte

'\u0000' to '\uffff'


Operators 

An operator is a symbol that tells the computer to perform a particular math or logic operation. Some of the most common operators are:

...