Lernpfad:Objektorientierte Programmierung mit Java/Datentypen und Variablen: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Jneug (Diskussion | Beiträge) |
Jneug (Diskussion | Beiträge) |
||
Zeile 10: | Zeile 10: | ||
! Beschreibung | ! Beschreibung | ||
|----- | |----- | ||
| boolean || undefiniert<ref>https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html</ref> | |<code>boolean</code> || undefiniert<ref>https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html</ref> | ||
| true / false | | true / false | ||
| Wahrheitswert, Boolescher Typ | | Wahrheitswert, Boolescher Typ | ||
|- | |- | ||
| char || 16 bit | |<code>char</code> || 16 bit | ||
| 0 ... 65.535 (z. B. 'A') | | 0 ... 65.535 (z. B. 'A') | ||
| [[wikipedia:Unicode|Unicode]]-Zeichen (UTF-16) | | [[wikipedia:Unicode|Unicode]]-Zeichen (UTF-16) | ||
|- | |- | ||
| byte || 8 bit || -128 ... 127 | |<code>byte</code> || 8 bit || -128 ... 127 | ||
| [[Zweierkomplement]]-Wert | | [[Zweierkomplement]]-Wert | ||
|- | |- | ||
| short || 16 bit | |<code>short</code> || 16 bit | ||
| -32.768 ... 32.767 || [[Zweierkomplement]]-Wert | | -32.768 ... 32.767 || [[Zweierkomplement]]-Wert | ||
|- | |- | ||
Zeile 27: | Zeile 27: | ||
| -2.147.483.648 ... 2.147.483.647 || [[Zweierkomplement]]-Wert | | -2.147.483.648 ... 2.147.483.647 || [[Zweierkomplement]]-Wert | ||
|- | |- | ||
| long || 64 bit | |<code>long</code> || 64 bit | ||
| -2<sup>63</sup> bis 2<sup>63</sup>-1, ab Java 8 auch 0 bis 2<sup>64</sup> -1<ref>https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html</ref> | | -2<sup>63</sup> bis 2<sup>63</sup>-1, ab Java 8 auch 0 bis 2<sup>64</sup> -1<ref>https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html</ref> | ||
| [[Zweierkomplement]]-Wert | | [[Zweierkomplement]]-Wert | ||
|- | |- | ||
| float || 32 bit | |<code>float</code> || 32 bit | ||
| +/-1,4E-45 ... +/-3,4E+38 || 32-bit [[wikipedia:IEEE 754|IEEE 754]], es wird empfohlen, diesen Wert nicht für Programme zu verwenden, die sehr genau rechnen müssen. | | +/-1,4E-45 ... +/-3,4E+38 || 32-bit [[wikipedia:IEEE 754|IEEE 754]], es wird empfohlen, diesen Wert nicht für Programme zu verwenden, die sehr genau rechnen müssen. | ||
|- | |- | ||
| double || 64 bit | |<code>double</code> || 64 bit | ||
| +/-4,9E-324 ... +/-1,7E+308 || 64-bit [[wikipedia:IEEE 754|IEEE 754]], doppelte Genauigkeit | | +/-4,9E-324 ... +/-1,7E+308 || 64-bit [[wikipedia:IEEE 754|IEEE 754]], doppelte Genauigkeit | ||
|} | |} |