Data Types

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

Scientific Numbers

A floating point number can also be a scientific number with an "e" to indicate the power of 10

Non_Primitive Data Types

Non-primitive data types are called reference types because they refer to objects. Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc.

Floating Point Types

Represents numbers with a fractional part, containing one or more decimals. There are two types: float and double. You should use this type whenever you need a number with a decimal, such as 9.99 or 3.14515.

Primitive Data Types

Specifies the size and type of variable values, and it has no additional methods. Includes byte, short, int, long, float, double, boolean and char. Primitive number types are divided into two groups: Integer types and floating point types.

Integer Types

Stores whole numbers, positive or negative (such as 123 or -456), without decimals. Valid types are byte, short, int and long. Which type you should use, depends on the numeric value.

Float

This data type can store fractional numbers from 3.4e−038 to 3.4e+038. Note that you should end the value with an "f"

Booleans

This data type is declared with the boolean keyword and can only take the values true or false

Strings

This data type is used to store a sequence of characters (text). String values must be surrounded by double quotes. Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc.

Characters

This is used to store a single character. The character must be surrounded by single quotes, like 'A' or 'c'

Double

This type can store fractional numbers from 1.7e−308 to 1.7e+308. Note that you should end the value with a "d"


Set pelajaran terkait

Multiplication and Division 0 - 12

View Set

Chapter 23 Communicable Diseases

View Set

Module 4 - Macro Measures of the Economy and the Business Cycle

View Set

CompTIA IT Fundamentals Domain 3 Study Guide

View Set

Medicare and Long-Term Care Insurance

View Set