Java Variables And Data Types

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Other Types

booleans (1) and char (2)

Integer Types

byte (1), short (2), int (4), long (8)

Camel case

capitalize the first letter of all words after the first javaProgramsAreHard

'+' / ->

combines two strings without spaces

operations can only be performed between___

compatible data types

It is the compiler's job to___

reserve the sufficent amount of memory for the sifferent types of variables

Variable

the name of some location in memory used to hold a data value

assigning decimal places to float

("%.2f", variable) . _ _

Valid variable names

1. does not start with a number 2. cannot be reserved names 3. do not use & or -

string1.equals(string2)

Checks to see if the two strings are the same (don't use ==)

string1.compareTo(string2)

If less than 0, string1 comes before string2 in the dictionary = 0, they are the same Greater than 0, string2 comes before string 1 in the dictionary (lexicographically)

string.length()

Returns the length of a string

string comparison

The operators should not be used with strings; unexpected results will occur.

T or F: Variable values can be changed later

True

Comparison operators return ___

a boolean: true or false

Identifiers

all java names

escape sequences

allows the use of single or doublequotes or other special characters

Floating-Point types

float (4), double (8)

Constants are also known as___

literals

long data type

must be followed by "L"

float data type

must be followed by "f"


Ensembles d'études connexes

Financial Accounting - Chapter 11: Liabilities: Bonds Payable

View Set

Gerontology Module 7 - Balance and Falls

View Set

NUTR 202 Exam 3 Review Questions

View Set

Anatomy of shoulder movement and muscles

View Set

Chapter 25: Assessing the Neurologic System

View Set

One-Party and Multi-Party Governments

View Set