Java Primitive Data Types and Variables

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Byte

1 byte data type Value range: −128 to 127

Short

2 byte data type Value range: −32768 to 32767

Float

4 byte data type Value range: 3.4e−038 to 3.4e+038

Integer

4 byte data type Value range: −2,147,483,648 to 2,147,483,647

Double

8 byte data type Value range: 1.7e−308 to 1.7e+038

Long

8 byte data type Value range: 9,223,372,036,854,775,808 to 9,223,372,036,854,755,807

Integer

A data type that can hold whole numbers such as 123 and −96

Immutable

A term to explain that once created, the values cannot be changed.

Character

Data type that stores character constants in the memory, which can hold only a single unicode character. Value range: 'u0000' (or 0) to 'uffff' (or 65,535, inclusive).

Floating Point

Data type used to represent numbers with a fractional part (two words). There are two subtypes.

Boolean

Data type used to store values with two states: true or false.

Parameters

These are the variables that are passed to the methods of a class.

Data Types

These include: Integers: Byte, Short, Int, Long Floating Points: Float, Double Characters Booleans

Constants

Variables whose values remain the same throughout the program. They are also called Literals. Include String, Character, Boolean, and Numeric types.

Local

___ variable. A method stores its temporary state in this variable type. These variables are only visible to the methods in which they are declared; they are not accessible from the rest of the class.

Instance

___ variable. Has values that are unique to each instance of a class. For example, the currentSpeed of one bicycle is independent from the currentSpeed of another.

Static

___ variable. There is exactly one copy of this variable in existence, regardless of how many times the class has been instantiated. For example, the number of gears for a bicycle might be the same number of gears, which will apply to all instances.


Set pelajaran terkait

Classical Era Civilizations-Essential

View Set

Study.com Financial Management Chapter 7

View Set

Child Health Exam 1 Practice Questions

View Set

Unit 8-The Digestive System and Nutrition

View Set

Nationalism : expansionist nationalism

View Set

Chapter 27: Amine, amino acid and polymers

View Set