Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
81 Cards in this Set
- Front
- Back
abstraction |
process of separating ideas from instances
focuses on object behavior |
|
What does abstraction do? |
Abstraction facilitates the development of classes in terms of their functionality instead of their implementation details. |
|
How does Java support abstraction? |
Java supports the creation and existence of abstract classes that expose interfaces without including the implementation of all methods. |
|
interface attributes |
- Members of an interface are public by default
- Variables in an interface are final by default
- A class an inherit from more than one interface, but only one class
- All interface methods are implicitly abstract |
|
abstract class attributes |
- A class an inherit from more than one interface, but only one class
- An abstract class can inherit from an interface without implementation
- An abstract cannot be instantiated, but can be invoked if it has a main() |
|
interface |
A set of methods that can be called on an object that does NOT provide concrete implementations for all methods |
|
polymorphism |
The provision of single interface to entities of different types |
|
What does polymorphism facilitate? |
Polymorphism enables one to "program in the general"
Polymorphism enables one to write programs that process objects that share the same superclass or interface as if they are all objects of the class |
|
Array attributes |
- Arrays can contain primitives or objects
- Arrays have a fixed size
- class Array has fewer methods than ArrayList |
|
ArrayList attributes |
- ArrayList can only contain objects; must use autoboxing/unboxing for primitives
- ArrayList size is dynamic
- ArrayList has more methods than Array (addAll, removeAll, iterator, etc. |
|
static |
keyword that allows a member variable or method to be accessed without requiring the instatiation of its class |
|
information hiding |
strategy to provide abstraction |
|
encapsulation |
mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse. |
|
What does an interface facilitate? |
- useful for assigning common functionality to unrelated classes
- allows unrelated classes to be processed polymorphically |
|
iterator |
interface that provides methods that are able to iterate over any collection
each Java Collection contains an iterator method that returns an iterator instance |
|
difference between Exception and Error |
- class Exception is used for exceptional conditions that a user's program should catch
- class Error defines exceptions that are not expected to be caught by a user program
- both are subclasses of Throwable |
|
map |
- Collection object that maps keys to values
- cannot contain duplicate keys |
|
pass by value |
- a copy of the object or primitive is passed
- changes made to the data do not affect the original value |
|
list |
- ordered collection that can contain duplicate elements |
|
primitive data types |
- byte - short - int - long - float - double - char - boolean |
|
set |
Collection that cannot contain duplicate elements |
|
basic interfaces of Java Collections Framework |
- Collection
- Set
- List
- Map |
|
collection |
- represents a group of objects known as elements |
|
Comparable |
interface with one method: compareTo(T o) |
|
throw vs. throws |
- throw is used to explicity raise an exception
- throws is used to indicate exceptions not handled by a method |
|
pass by reference |
- reference (memory location or hashcode) is passed
|
|
ArrayList |
- index-based structure, backed by an Array
- provides random access to elements; O(1) search
- consumes less memory than LinkedList |
|
LinkedList |
- stores data as list of elements with links to .next() and .previous()
- O(n) search
- insertion is faster with LinkedList than ArrayList; no resizing or index update
- LinkedList consumes more memory than ArrayList due to next and previous references |
|
access modifiers |
- public - private - protected - default (package) |
|
public modifier scope |
world |
|
private modifier scope |
class |
|
protected modifier scope |
package and subclasses |
|
default modifier scope |
package |
|
software development life cycle |
- analysis - design - implementation - mirror - planning |
|
finalize() |
called by garbage before releasing memory |
|
inheritance |
- process by which one object acquires the properties of another object.
- creation of new class by absorbing an existing class's members and embellishing them with new or modified capabilities
- facilitates code reuse |
|
superclass |
original class from which a new class inherits |
|
subclass |
new class that inherits from an older class |
|
direct superclass |
subclass is closest descendant |
|
indirect superclass |
subclass is above direct superclass |
|
types of polymorphism |
- ad-hoc
- parametric: generic programming
- subtyping: name may denote instances of different classes related by a superclass or interface |
|
ad-hoc polymorphism |
function overloading |
|
parametric polymorphism |
generic programming |
|
subtype polymorphism |
name may denote instances of different classes related by a superclass or interface |
|
JVM |
Java Virtual Machine |
|
purpose of JVM |
- execute Java bytecode
- allow Java to run on any platform |
|
encapsulation |
packing of data and methods into a single software component |
|
purpose of encapsulation |
- used to control access to data members and functions
- access to private data is restricted to object members and methods |
|
autoboxing/unboxing |
automatic conversion made by the Java compiler between primitive types and their corresponding wrapper classes
- autobox: primitive -> wrapper
- unbox: wrapper -> primitive |
|
garbage collection |
- automatic algorithm that reclaims space that is occupied by dereferenced objects
- can be manually triggered by Object.finalize(), though not advised |
|
purpose of garbage collection |
- identify and discard objects that are no longer needed by the application
- reclaim system resources for new use |
|
immutable object |
object cannot be modified after it is created |
|
benefits of immutable objects |
- inherently thread safe
- simpler
- offers higher security |
|
method overloading |
methods of the same name can be declared in the same class as long as they have different sets of parameters |
|
purpose of method overloading |
commonly used to create several methods with the same name that perform a similar task with different data types or a different number of arguments |
|
abstract class |
- incomplete class for which one never intends to create objects
- used only as superclass in inheritance hierarchies
- abstract methods do not provide implementation |
|
ACN stock price |
- 5 year growth from 37 to 90
- 1 year: traded between 75 and 90 from
- currently about 85 |
|
core value: stewardship |
build a stronger company for future generations |
|
Comparator |
interface with two methods:
- compare(T o1, T o2)
- equals(T o) |
|
JRE |
- Java Runtime Environment
- basically the JVM (where programs execute) |
|
JDK |
- Java Development Kit
- includes JRE, compilers and development tools |
|
core value: best people |
attract, develop and retain the best talent |
|
core value: stewardship |
build a stronger company for future generations |
|
core value: client value creation |
- help clients perform at a high-level
- create long-term relationships by being responsive, relevant and consistently delivering value |
|
core value: one global network |
leverage institutional knowledge to deliver value to the client |
|
core value: respect for the individual |
- value diversity
- foster a trusting and inclusive environment |
|
core value: integrity |
- say what you mean
- match words to action |
|
method overriding |
instance method in a subclass with same signature and return type as an instance method in the superclass replaces functionality of the superclass's method |
|
@Override |
annotation helps assure method is overriding instead of overloading |
|
checked exception |
must be declared in a method or constructor's throws clause |
|
unchecked exception |
doesn't need to be declared in a method or constructor's throws clause if the exception can propagate beyond the scope of the original call |
|
priority queue |
- unbounded queue, based on priority heap - developer can provide Comparator upon creation - does not allow null values, object without natural ordering or objects without a Comparator associated - not thread safe - requires O(n log n) for enqueing and dequeing operations |
|
Unicode |
internal representation of characters and strings
uses 16 bits to represent each other |
|
System.gc() |
explicit call for garbage collection |
|
transient |
modifiier that applies to variables only and it is not stored as part of its object’s Persistent state. Transient variables are not serialized. |
|
volatile |
modifier that applies to variables only and it tells the compiler that the variable modified by volatile can be changed unexpectedly by other parts of the program. |
|
inner class |
classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private
nested classes can lead to more readable and maintainable code; increases encapsulation |
|
anonymous class |
class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors. |
|
reflection |
java.lang.reflect package has the ability to analyze itself in runtime. |
|
String vs StringBuilder |
- String is immutable
- StringBuilder is mutable |
|
StringBuilder vs StringBuffer |
- StringBuilder is single-threaded
- StringBuffer is multithreaded |