What does javac do?
The command that compiles the code into a class file.
What is an arithmetic operator in Java?
What is OOP?
A programming paradigm based on objects and data.
What are data structures?
How do you explicitly destroy an object in Java?
object = null;
System.gc();
What does the java command do?
java followed by the filename is used to execute the java program.
Which are the relational operators in Java and what do they do?
They are used to compare two values. == (Equal), != (Not Equal), < (Less than), > (Greater than), <=, >=
What is the difference between a strongly typed and loosely typed programming language?
For Strongly Typed, variables can only store one type of data. Loosely typed can store any data at any point.
Name three examples of data structures in Java?
What is a constructor?
A method that allows for object creation with specific attribute values being assigned.
What is a variable?
A variable is a reserved memory location used to store information.
Which control structure is used to make decisions based on conditions?
The if-else control structure.
What's the difference between a Class and an Object?
Why is prototyping used in ArrayLists or HashMaps?
To determine which kind of objects a data structure will contain.
Which part of a method or function determines which variables should be use to invoke it?
The method signature.
Name three data types for variables?
int, char, boolean, String, float, etc...
What are the three sections in the for loop?
initialization; condition; update
How do you instantiate a class named Student?
Student theStudent = new Student();
What method is used to add items to an ArrayList?
arrayList.add(item);
What is the use of the return keyword inside of a function?
It allows for communicating a return value between methods.
What's the difference between Integer and int?
One is a class (Integer) the other is a primitive type.
Which cicle is designed to guarantee at least one iteration?
The do-while loop.
What are the two main components of a class?
Attributes and Methods
Declare an array of 5 numbers and then invert the array by using a for loop.
int[] numbers = {1, 2, 3, 4, 5};
int[] temporary = {0, 0, 0, 0, 0};
for(int i=0; i<5; i++) {
temporary[5-1-i] = numbers[i];
}
numbers = temporary;
What is the garbage collector?
The mechanism that Java uses to dispose of unused references or orphaned objects.