Lesson 1- Data Types in JAVA

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

True or false: AbCd and ABCD are two different identifiers.

True. Case matters with identifiers.

a variable must be ___ before you can use it

declared- using a variable before declaring it is like trying to eat when you don't have any food.

There are ___ different data types in JAVA.

eight

Boolean type

true/false value

A character is stored using ___ bytes of information.

two, or 16 bits (binary)

5 math operators

+ Addition, as well as unary + - Subtraction, as well as unary - * Multiplication / Real and integer division % Modulus, remainder of division

4 rules for identifiers:

1. Identifiers must begin with a letter. 2. Only letters, digits, or underscores can follow the first letter. 3. No blank space.

True/false a character is stored as an ASCII value.

True- a character is stored as its corresponding ASCII value, which is an int. This makes it easy to convert from char to int.

is this valid code? char c = 'C'; int c1 = c; // Is the part before this valid? c1 = 68; c = (char)(c1); // What is the value of c now?

Yes, the code is valid. c = 'D'.

Identifier

a name that will be used to describe classes, methods, constants, variables, and other items

Integer type

any positive or negative number without a decimal point (byte, short, long, int)

Floating point type

any signed or unsigned number with a decimal point (double, float)

True/false variables can only be declared at the top of the program

false, they can be declared anywhere in the code.

If either or both of the operands are floating point numbers, the result is a(n) ___.

floating point number

If both operands are integers, the result is a(n) ___.

integer

Character type

letters, digits 0..9, and punctuation symbols (char)


Set pelajaran terkait

Intro to Psychology- Chapters 1-14

View Set

Medical-Surgical Nursing Chapter 50 Endocrine Problems

View Set

PrepU Chp 28: Assessment of Hematologic Function and Treatment Modalities

View Set

Level 1 Antiterrorism Awareness Training

View Set

psychology CH 11 review quiz questions

View Set