Flashcards
Week 1 Lecture (quiz)
Cards in this deck (10)
- 1Declarationset type creates a variable (allocates space in memory)
int x ;
int x = 5;
{int x} is the declaration - 2Initializationassigns an initial value
int x = 5
The 5 is the initialization - 3Assigning a value'='
the = sign assigns values - 4Primitive Data TypesByte
Short
Int
Long
Char
Float
Double
Boolean - 5How do we define Constants?final plus All Caps
final int QUARTAR_VALUE = 0.25
final float PI = 3.14 - 6Typecastingdouble saleTotal = 175.05;
final double PA_SALES_TAX = 0.07;
double balance = salesTotal * PA_SALES_TAX;
int dollars = (int) balance; - 7String VariablesString name = "Harry"
"Harry" is a string literal - 8how do you find the lenght of a String?firstName.length();
String firstName = "Harry";
int n = firstName.length(); - 9escape sequence\t
\n
\'
\" - 10String => Numbersint x = Integer.parseInt("5");
Double, Float, Byte
Information
- Description
- Java 0017 Flashcards on Week 1 Lecture (quiz), created by David Hinton on 07/09/2017.
- Created by
- David Hinton
- Views
- 0
- Rating
More on Variables, Constants and Data Types