MidTerm Flashcards
(35 cards)
Variable represented in
Unicode
Variable Name
must start with a character, and can include any unicode character
Two datatypes of Java
Primitive and Non-primitive
Primitive examples
byte, short, long, int, float, double, boolean and char
Non-primitive examples
String, Array, Classes
byte size
1 byte; -2^7 to 2^7 where 7 = 8 - 1
short size
2 byte; -2^15 to 2^15 where 15 = 2x8-1
int size
4 byte; -2^31 to 2^31 where 31 = 4x8-1
long size
8 byte; -2^(8x8-1) to 2^(8x8-1)
char size
2 byte
float
4 byte; 6 to 7 decimals
double
8 byte; 15 decimals
in Java, non-primitives are known as
reference types
Shortcut If then else
exp ? true : false
Strongly typed is
strict rule with data type conversion
Statically typed
safe and secure; it cannot ever be bound to an object of a different type
Dynamically typed
unpredictable behavior; can be assigned to objects of different type
Strings are
immutable
If you wish to have a string you can change the value of you should use
Stringbuffer
If i want to concat a string together how?
s=s.concat(“ appended”);
A ______ is a non-primitive data type in Java, while an _______ is an instance of a class
class object
Why a class is the blueprint or template for an object ?
the complete syntax for handling encapsulation, abstraction, polymorphism, and inheritance
before compilation file extension for class
.java
after compilation file extension for class
.class