1. Arithmetische Operatoren:
Die Arithmetischen Operatoren ( +, -, * und /) benötigen wir um Berechnungen zu unternehmen, wie ihr sicher noch aus dem Mathematikunterricht kennt. In Java ist es wichtig wenn ihr Berechnungen machen wollt das die Datentypen immer die selben sind.
Beispiel:
float a = 1.5f;
float b = 23.49f;
float c;
c = a + b;
c = a / b;
c = a - b;
c = a * b;
2. Der Modulo - Operator:
Der Modulo - Operator ( % ) gibt einen Rest einer Integer-Division zurück.
Beispiel:
int a = 25;
int b = 12;
int c;
c = a % b;
In diesem Beispiel ist der Rest 1.
3. Inkrementation & Dekrementation:
Die Inkrementation und Dekrementation ( ++, - - ) erhöht oder verringert einen wert um 1.
Beispiel:
int x = 10;
x = x++;
In diesem Beispiel der Inkrementation (Erhöhung) ist das Ergebnis 11.
x = - - x
In diesem Beispiel der Dekrementation (Erniedrigung) ist das Ergebnis 9.
English:
1. arithmetic operators:
We need the arithmetic operators ( +, -, * and /) to make calculations, as you probably know from mathematics lessons. In Java it is important if you want to do calculations that the data types are always the same.
Example:
float a = 1.5f;
float b = 23.49f;
float c;
c = a + b;
c = a / b;
c = a - b;
c = a * b;
2. the modulo operator:
The modulo operator ( % ) returns a remainder of an integer division.
Example:
int a = 25;
int b = 12;
int c;
c = a % b;
In this example, the remainder is 1.
3. incrementation & decrementation:
The incrementation and decrementation ( ++, - - ) increases or decreases a value by 1.
Example:
int x = 10;
x = x++;
In this example of incrementation, the result is 11.
x = - - x
In this example of decrementation (humiliation) the result is 9.
Translated with www.DeepL.com/Translator