1 / 11

Einfache Datentypen und ihre Operatoren Übersicht

Einfache Datentypen und ihre Operatoren Übersicht. Grunddatentypen. false. ‘u0000‘. 0. 0. 0. 0. 0.0. 0.0. Arithmetische Operatoren. Post- und Präinkrement. … int a = 2; System.out.println(a++); System.out.println(a); …. Aber…. … int a = 2; System.out.println(++a);

alton
Télécharger la présentation

Einfache Datentypen und ihre Operatoren Übersicht

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Einfache Datentypen und ihre Operatoren Übersicht Wahlfach Informatik mit Java

  2. Grunddatentypen false ‘\u0000‘ 0 0 0 0 0.0 0.0 Wahlfach Informatik mit Java

  3. Arithmetische Operatoren Wahlfach Informatik mit Java

  4. Post- und Präinkrement … int a = 2; System.out.println(a++); System.out.println(a); … Aber… … int a = 2; System.out.println(++a); System.out.println(a); … Wahlfach Informatik mit Java

  5. Typ boolean boolean a;a = true; boolean a = true; Oder auch… Boolesche Größen können nur mit zwei Werten belegt werden true oder false. Häufig ist der zugewiesene Wert das Ergebnis einer Auswertung: boolean a; a = 3 == 2; a erhält den Wert false. Wahlfach Informatik mit Java

  6. Relationale Operatoren Diese Ausdrücke werden zu einem booleschen Wert ausgewertet Wahlfach Informatik mit Java

  7. Wie wertet Java aus? boolean a;int b = 7;a = b%2 == 0; 1 Wird als Rest der Ganzzahldivision von 7 und 2 zu 1 ausgewertet. Der rechts stehende Ausdruck ist ausgewertet. Die links stehende Variable wird mit diesem Wert belegt. false Prüft das links und rechts von == stehende auf Werte-Gleichheit. a hat den Wert false Wahlfach Informatik mit Java

  8. Logische Operatoren Wahlfach Informatik mit Java

  9. Welcher Wert hat test- Welchen Wert hat b nach der 2ten Zeile? int a = 2, b = 2; boolean test = (a%2==0)&& (b++%2 == 0); (++b%2==0); int a = 3, b = 2; boolean test = (a%2==0)&& (b++%2 == 0); (++b%2==0); Wahlfach Informatik mit Java

  10. Zuweisungsoperatoren Wahlfach Informatik mit Java

  11. Sonstige Operatoren Wir sagen der Operator ‚+‘ ist überladen: Er addiert int, double, etc oder verkettet Strings String test = ((a%4==0) && (a%100!=0))||(a%400==0) ? "Ist Schaltjahr" : "Ist kein Schaltjahr"; String anrede = (geschl=='w')?"Frau":"Herr"; oder:System.out.print("Hallo" + (weiblich?"Frau":"Herr") + "Müller"); Siehe nächstes Kapitel Wahlfach Informatik mit Java

More Related