Data Types

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

whole number data types

byte, short, int, long

floating point data types

float, double

expression

A group of numbers and mathematical symbols that can be evaluated to a single value.

boolean expression

A group of numbers and mathematical symbols that can be evaluated to either a true or a false (1 or 0)

byte

It has a minimum value of -128 and a maximum value of 127 (inclusive). It holds 8 bits of memory. It is a whole number/integer. This is used when you know you will not need large numbers. If you need a small range of numbers but no one number will be a large size number itself it saves memory. Its range includes negative and positive numbers. Example; player numbers on football jerseys.

int

It has a minimum value of -231 and a maximum value of 231 -1. It is a whole number./integer This is potentially a pretty big number. Example: this is enough to reach the low billions but not enough to measure how much money Bill Gates has, so it's OK for most bank accounts but not the biggest.

char

The char data type is a single character. It has a minimum value of 0 and a maximum value of 65,535 inclusive when referring to the character codes in the Unicode system for a keyboard or a language. It s value is always enclosed in single quotes. This can represent a lot of language characters.

primitive

a basic data type that is made of a single value. Each one has a designated memory size available that it will be stored in. These are built into the Java programming language and execute very fast inside of a processor.

constant

a value that cannot be changed after being created. It can be either a named value in memory or a literal constant such as an actual number (like 3.14).

long

It has a minimum value of -263 and a maximum value of 263-1. Use this data type when you need a very large range of values that is wider than those provided by int. It can reach into the low quintillions (a little over 9.2 quintillion).

short

It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). It is a whole number. The same idea applies to a short data type as to a byte except that it can hold a larger number. Its range includes negative and positive numbers as well.

strongly typed

Java requires each variable to be declared as a certain type of data. The data type defines the size of memory needed to store the data and the kinds of operations that can be performed on the data. When you create a variable to hold some data in Java it will reserve enough memory to hold the maximum value of that data type possible.

boolean

The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information and is usually used in conditional (if) statements.

float

This is a decimal type number that uses 32 bits of memory. The decimal point can "float" in its position and the amount of places to the right of the decimal point can vary. This can increase precision in the decimal part of the number or increase the large scale size of the number. This data type is used when you could have a very large range of possible numbers.

double

This is also a decimal that uses 64 bits of memory. The decimal point can be moved as needed to provide greater fractional places or greater whole number places. This can increase precision in the decimal part of the number or increase the large scale size of the number.


Kaugnay na mga set ng pag-aaral

NUR 1020 Fundamentals - Ch 27 safety

View Set

Organizational behavior chapter 1

View Set

Chapter 01: Introduction to Pathophysiology

View Set

NUR 108 Chapter 101 Basic Principles of Cancer Chemotherapy

View Set