Basic Java Programming Flashcards
1
Q
Name the types of data types in Java.
A
- Primitive data types used to store simple values
- Refernce data types used to store the address of Objects
2
Q
What is the fomular for calculating range of values for number data types?
A
-2^n-1 to 2^n-1 -1
where n is the number of bits for each data type
3
Q
Name all number data types and the bits for each type.
A
byte => 8 bits
short => 16 bits
int => 32bits
long => 64bits
4
Q
Name all the floating point datatypes and the number of bits for each
A
float => 32 bits
double => 64 bits
5
Q
How many bits are booleans, and char’s?
A
boolean => 1 bit
char => 16 bits
6
Q
Name a few reference datypes?
A
Classes
Strings
Arrays
Interfaces
7
Q
What are the type of variables in Java?
A
- Local variables: variables that exist only within a block or method
- Instance variables: Variables that belong to an object or class and are not static
- Static variables: Variables shared accross all objects
- Parameters
8
Q
What are the different types of operators in Java?
A
- Arithmetic
- Logical
- Relational
9
Q
name 3 types of loops in Java
A
for, while, and do while