background preloader

Variabler

Facebook Twitter

Klasser

Prov. Thenewbostons kanal 7. Thenewbostons kanal 5 - variabler. Thenewbostons kanal 6. f7.pdf (application/pdf-objekt) Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics) The Java programming language is statically-typed, which means that all variables must first be declared before they can be used. This involves stating the variable's type and name, as you've already seen: Doing so tells your program that a field named "gear" exists, holds numerical data, and has an initial value of "1". A variable's data type determines the values it may contain, plus the operations that may be performed on it. In addition to int, the Java programming language supports seven other primitive data types. A primitive type is predefined by the language and is named by a reserved keyword.

Primitive values do not share state with other primitive values. Byte: The byte data type is an 8-bit signed two's complement integer. In addition to the eight primitive data types listed above, the Java programming language also provides special support for character strings via the java.lang.String class. Default Values Literals Integer Literals Floating-Point Literals.