special method that constructs instance of classes
Back
JRE
Front
Java Runtime Environment: JVM + libraries
Back
Difference between break and continue
Front
Break ceases the logic of current block's code
Continue also ceases the logic of the current block's code but then returns to the top of the loop
Back
String
Front
class that is implemented using an array of characters. It is also immutable which means it can't be changed
Back
Method vs Function
Front
Method is attached to an object, function is not
Back
Handle Keywords
Front
try, catch, finally, throw, throws
Back
Static/Class Scope
Front
One copy of the variable and/or method
Back
Checked vs Unchecked
Front
Checked: the compiler will give a syntax error if the exception is not handled
Unchecked: the compiler does NOT give a syntax error if the exception is not handled
Back
Overloading
Front
When you have multiple methods with the same name but with different parameter lists
Back
JDK
Front
Java Development Kit: JRE + Devtools (debuggers, compiler, etc.)
Back
Heap
Front
Live portion of memory
Back
Garbage collector
Front
Looks through the heap and deallocates memory for us
Back
Object
Front
group of states (variables) and actions/behaviors (methods)
Back
Three Ways to Change the Parameter List
Front
Change the order of parameters, number of parameters, or the data types
Back
Array
Front
series of data entries of the same type
Back
Short Circuit Operators
Front
|| && purpose is to speed up logic
called short-circuit operator because it conditionally evaluates its second operand. If the first operand evaluates to false, the value of the expression is false, regardless of the value of the second operand.
&& It evaluates to true if and only if both operands of logical AND are true. If either or both operands are false, it evaluates to false.
|| evaluates to true if either or both of its operands are true. If both operands are false, it evaluates to false.
*
Back
What does the "super" keyword target?
Front
The parent
Back
Instantiate vs Initialize
Front
Instantiate: creation of an object
Initialize: creating of a variable
Back
Deprecated
Front
The support for that method has been discontinued. Will still work for backwards compatibility but will let the developer know they should be switching to a new system
Back
Which scopes give default values?
Front
Class/Static and Object/Instance
Back
Static
Front
Value belongs only to the class. To avoid creating instances
Back
Why are Strings immutable?
Front
All string literals are put into the String Pool. If you were to change a string within that pool, it would change all references to that string object
Back
Casting
Front
Taking an Object of one particular type and "turning it into" another Object type
Back
Shadowing
Front
When a child inherits from a parent, it stores two copies of a variable with the same name. The parent's variable becomes harder to access
Back
Flow Control
Front
Flow control statements break up the normal flow of execution. Examples of this include for loops, if statements, do while, while loops, switch case, etc.
Back
Difference between throw, throws, and Throwable
Front
throw: Throws an exception
throws: The method itself throws the exception
Throwable: Class that encompasses errors and exceptions and allows us to create our own custom exceptions
Back
Whats our signature/entry point?
Front
public static void main(String[] args)
Back
Overriding
Front
Changing the logic of the method with the same name from a child class. You can't access the parent's method because the child deleted and replaced the parent's method
Back
Scopes in Java
Front
Static/Class: one copy of the variable and/or method
Instance/Object: each instance has a copy of the variables and/or methods
Method: variables that only exist within the method
Block/Local: only exist within the block
Back
Class
Front
blueprint for objects
Back
Autoboxing
Front
Automatic conversion from primitive to reference types
Back
Four Access Modifiers
Front
public, private, protected, and default
Back
Protected
Front
The class, the current package, children
Back
Default
Front
The class and the current package
Back
Array vs Arraylist
Front
Array has a fixed size while Arraylist is dynamic
Back
String Pool
Front
Concept in Java that minimizes necessary for redundant strings. Its purpose is to be less memory intensive
Back
JVM
Front
Java Virtual Machine: Translates Java code so that the machine can read it
Back
How to force the garbage collector?
Front
You cannot force the garbage collector but you can suggest it by typing a System.gc();
Back
Setters and Getters
Front
Methods that retrieves private variables, associated with Encapsulation
Back
What does the keyword "this" target?
Front
The current instance
Different ways to use: refer current class instance variables, invoke current class constructor, return the current class instance, as method parameter, invoke current class method, as an argument in the constructor call
Back
Two Types of Polymorphism & Examples
Front
Compiled: Polymorphism that can only be checked during runtime (overloading)
Runtime: Polymorphism that can only be checked during runtime (overriding & type casting)
Back
Unboxing
Front
Automatic conversion from reference to primitive types
Back
What is the minimum you need to run Java?
Front
JRE
Back
Wrapper Class
Front
A class that wraps primitive types into reference objects
Back
Instance/Object Scope
Front
Each instance has a copy of the variable and/or methods
Back
Difference between exception and error
Front
Exception: An issue that arises in the code that interrupts the normal flow of the program (checked)
Error: An issue that happens outside of the code (and outside the developers control) that interrupts the normal flow of the program (unchecked)
Runtime: Exception thrown during runtime (unchecked)
Back
Is Java pass by value or pass by reference?
Front
Java is strictly pass by value.
Back
Why Java?
Front
Oracle upkeep, free, popularity, OOP, automatic garbage collector, based on C, rich API
Back
Package
Front
used to group similar classes and/or classes that work closely together to achieve some goal
Back
Section 2
(22 cards)
Can you override a final constructor? How about a static method?
Front
No, constructors aren't inherited to begin with so how can they be overridden?
And static methods cannot be overridden either.
Back
Comparator vs Comparable
Front
Comparator: Unnatural ordering. You have to specifically tell a sorting method to use it.
Comparable: Defines the natural or common ordering of an object. Will default to this if a comparator is not specified
Back
Covariant Throws Declaration
Front
Reducing the amount of possible exceptions that can be thrown BUT you cannot add NEW exceptions that can be thrown. Additionally, you are able to remove ALL thrown exceptions in the overriden method's logic. (exceptions are checked)
Back
Subprocess
Front
Process that utilizes the same memory space as another process
Back
What are implicit variable modifiers for an interface?
Front
public static final
Back
Interface
Front
Its a contract that forces classes to implement its methods (its a blueprint of a class)
Back
Which of the collections don't allow duplicates?
Front
Sets
Back
Thread
Front
a process of execution (a line of logic)
Back
Generics
Front
Use angle brackets to create a "placeholder" for a future datatype
Back
Abstract Class
Front
A class that defines attributes and methods for subclasses but is never instantiated
Back
Covariant Return Type
Front
Narrowing the range of possible return objects BUT you cannot widen the range of possible return objects (Wider to narrow)
Back
States of a Thread
Front
New: newly created
Waiting: indefinitely waiting for another thread to run
Timed Waiting: wait for a fixed time
Runnable: scheduler is allowed to give CPU time
Blocked: if another thread is already using synchronized method
Terminated: thread terminated
Back
Reflection
Front
Allows one to view an object or primitive during runtime. You may also modify the object's structure during runtime
Back
What are implicit method modifiers for an interface?
Front
abstract and public
Back
How To Create a Thread?
Front
1. Extending thread class
2. Implementing Runnable interface
Back
Collection vs Collections
Front
Collection: Interface that include Set, List, and Queue
Collections: Utility class filled with static method that aid with objects that are of the Collection type
Back
Covariant Access Modifiers
Front
Allowing MORE possible classes to use the method BUT you cannot take access AWAY from classes that already had access to the method. (Narrow to Wider)
Back
Difference between == and equalsTo
Front
==: Compares the memory address of two objects (exact same instance of an object)
equalsTo: Compares the contents of the class (does not need to be exact same instance of an object)
Back
Covariance
Front
When you override a method and alter the method signature in very specific ways (return types, access modifiers, and throws declarations)
Back
Difference between interface and abstract class?
Front
Interface: Abstract methods only (Java 8 added default which allows concrete now whoops), implements keyword, no constructor
Abstract: Abstract & concrete methods, extends keyword, allows constructors
Back
Final vs Finally vs Finalize
Front
Final: a keyword that indicates that its subject immutable. Variables cannot be changed, methods cannot be overridden, and classes cannot be extended
Finally: a block within a try-catch that always executes regardless if an exception is thrown
Finalize: calls preparation for garbage collection
Back
Singleton
Front
Class implementation that can be instantiated only once