Java Basics Flashcards
What is BIT an acronym for?
Binary Digit
How many bits in a byte?
8
How many possible values are in a byte?
256, or 2^8
What two types of programs translate source code to object code?
Interpreters and Compilers
Which type of translator program translates and executes line by line?
Interpreter
Is a compiler able to run source code?
NO
Which runs faster, interpreter or compiler?
Compiled programs
What two programming paradigms exist?
Procedural and Object Oriented
What is task decomposition?
Looking at an overall process and breaking down into smaller (atomic) tasks
What is another word for task decomposition?
Task Analyses
What did task analyses lead to?
Creation of algorithms
What two things do algorithms consist of?
1) What needs to be done
2) What order
What are the three control structures for any program?
1) Sequence
2) Selection
3) Repetition
What two things does an object have?
1) Properties (variables)
2) Methods
What is the Java API?
Application Programmer Interface, holds libraries of objects.
What is special about Java source code?
It can be run on any machine without changing it.
What is the Java compiler program called?
javac.exe
What is Java source code compiled to?
Byte code
Is Byte code able to run on any processor?
No
What is the JVM or JRE?
Java Virtual Machine or Java Runtime Environment, interpreter program specific to each processor.
Where is data from the keyboard stored in Java?
The Keyboard Buffer
What do you need to do to use a package from the Java API?
Import statement
Which input statement flushes the keyboard buffer?
input.nextLine();
Which statements need to be flushed afterwards?
nextInt(), nextFloat(), next(); nextDouble();
What is the character at the end of typing called?
End of Line character
New Line character
Carriage Return
What is a variable?
A storage location in the computer’s memory, or RAM.
What two things must a variable have?
1) A name
2) A data type
What are three other ways to say variable name?
1) Identifier
2) Reference
3) Handle
To create a variable, you must _______ it.
Declare
What are we doing when we declare a variable?
Binding to a memory address
What can a variable name NOT start with?
A number
What CAN a variable name start with?
A letter (A,a) A dollar sign ($) An underscore (_)
What words can’t be variable names?
Java Reserved Words
Why do we specify data types when declaring a variable?
It tells the computer how many bytes of memory to allocate the variable
ASCII and UNICODE share ___ characters.
256, or 2^8
What are the two data types?
1) Primitive
2) Object
What is the difference between primitive and object data types?
Primitive have no method associated with them.
How many primitive data types are there?
8
6 Numeric
2 Non-numeric
What are the 6 numeric primitive data types?
Byte Short Int Long Float Double
How may bits in a “short” data type?
16 bits, or 2 bytes
How many bits in an “int” data type?
32 bits, or 4 bytes
How many bits in a “long” data type?
64 bits, or 8 bytes
How many bits in a “float” data type?
32 bits, or 4 bytes
How many bits in a “double” data type?
64 bits, or 8 bytes
What are the 2 default numeric data types?
Int and Double
How many bits in a “char” data type?
16 bits, or 2 bytes
How is floating data stored?
As a mantissa and an exponent
What is the naming convention for constants?
UPPER_CASE_LETTERS
What keyword is used to declare a constant?
final
What is a string literal?
Surrounding a String of characters with quotation marks (“ “)