SCJP Study Guide 2
1 / 67
Term:
Definition:
Show example sentence
Show hint
Keyboard Shortcuts
  • Previous
  • Next
  • F Flip card

Complete list of Terms and Definitions for SCJP Study Guide 2

Terms Definitions
A sorted map TreeMap
HashMap, HashSet, Hashtable, LinkedHashMap, & LinkedHashSet use ___ hashing
no modifier preceding package-level access Default Access
Faster iterations; iterates by insertion order or last accessed; allows one null key, many null values LinkedHashMap
abstract, boolean, break, byte, case, catch, char, class, const, continue, default, do, double, else, extends, final, finally, float, for, goto, if, implements, import, instanceof, int, interface, long, native, new, package, private, protected, public, re Keywords
enums can contain constructors, methods, variables, constant class bodies
four access levels public, protected, private, default
Classes can have only ... access Classes can have only public or default access
Classes can have only ... access 2
There are ... access modifiers: ... There are three access modifiers: public, protected, and private
There are ... access modifiers: ... 3
No duplicates; iterates in sorted order TreeSet
Fast iteration and fast random access ArrayList
If you override equals(), override ___ hashCode()
variables declared within a method. destroyed when the method ends. are always on the stack, not the heap local variables
a reference variable marked ___ can't ever be reassigned to a different object final
the subclass can see the protected member only through ___ inheritance
declaring with keyword ___ makes it impossible to reinitialize a variable when it has been initialized with an explicit value final
int :b; int -d; int e#; int .f; int 7g; Illegal Identifiers
class can't be subclassed many classes in Java core library Final Classes
forces floating points to adhere to the IEEE 754 standard can modify a class or method but never a variable strictfp
When overriding equals(), use the ___ operator to be sure you're evaluating an appropriate class instanceof
Sorted Iterating through a collection in a sorted order
An overridden equals() must be at least as precise as its ___ mate hashCode()
Create many Comparators to sort a class many ways; implement ___ compare()
must start with letter, currency char, or connecting char such as underscore after 1st char, may contain any combination of letters, currency, connecting, or numbers no limit to number of chars no Java keywords case-sensitive int _a; int $c; int _____2_w; Legal Identifiers
modifiers on non-local variables final, public, protected, private, static, transient, volatile
a ___ argument must keep the same value it had when it was passed into the method final
defined inside the class but outside any methods. are only initialized when the class is instantiated. the fields that belong to each unique object instance variables
If two objects are equal, their ___ must be equal hashcodes
___ reverses the order of elements in a List Collections.reverse()
Like a slower HashMap (as with Vector, due to its synchronized methods). No null values or null keys allowed Hashtable
An ArrayList<Animal> can accept references of type Dog, Cat, or any other subtype of Animal (subclass, or if Animal is an interface, implementation)
NOT a String of an int; a ___'s constant's type is the ___ type. For example, WINTER, SPRING, SUMMER, FALL are of the ___ type Season enum
an enum declared ___ a class must NOT be marked static, final, abstract, protected, or private outside
a ___ can't ever, ever, ever have a return type constructor
public abstract interface Rollable {} Legal Interface Declaration (abstract modifier is redundant)
there are no final ___ only final ___ object, references
To be searched, an array or List must first be ___ sorted
can use any of the 4 access levels (which means they can be marked with any of the three access modifiers) can be final can be transient cannot be abstract cannot be synchronized cannot be strictfp cannot be native cannot be static, because then they'd be instance variables
the semicolon is ___ at the end of the enum declaration optional
can't be accessed by code in any class other than the class in which the ___ ___ was declared private member
An efficient hashCode() override ___ distributes keys evenly across its buckets
___ ___ ___ are inner classes marked with the static modifier Static nested classes
Iterate with the enhanced for, or with an Iterator via hasNext() & next()
there is no such thing as a ___ array, but you can make an array of ___ primitive, primitives
what are the two types of variables in Java? primitives, reference variables
A ... class cannot be subclassed A final class cannot be subclassed
Identifiers can begin with... a letter, an underscore, or a currency character
Identifiers can begin with... 3
From code within the enclosing class, you can instantiate the inner class using only the name of the inner class, as follows: MyInner mi = new MyInner();
Because of polymorphism, the only methods you can call on an anonymous inner class reference are those defined in the reference variable class (or interface), even though the anonymous class is really a subclass or implementer of the reference variable type
A static nested class is not an inner class, it's a top-level nested class
class A can: create instance of B extend B access certain methods and variables within B, depending Class Access "class A has access to class B"
There are ... access levels: ... There are four access levels: public, protected, default, and private
There are ... access levels: ... 4
A static nested class cannot access non-static members of the outer class, since it does not have an implicit reference to any outer instance (in other words, the nested class instance does not get an outer this reference)
If the compiler can recognize that non-type-safe code is potentially endangering something you originally declared as type-safe, you will get a compiler warning. For instance, if you pass a List<String> into a method declared as void foo(List aList) { aList.add(anInteger); } the compiler will issue a warning because the add() method is potentially an "unsafe operation."
A "regular" inner class is declared inside the curly braces of another class, but outside any method or other code block
An inner class instance shares a special relationship with an instance of the enclosing class. This relationship gives the inner class access to all of the outer class's members, including those marked private
the first concrete subclass of an abstract class must implement all abstract methods of the superclass
package and import statements apply to ... in the file package and import statements apply to all classes in the file
To instantiate an inner class, you must have a reference to an instance of the outer class
What's the relation between the source file name and the names of the classes contained in the source file? If the source file contains a public class, the filename must match the public class name
The generics type identifier can be used in class, method, and variable declarations: class Foo<t> { } // a class T anInstance; // an instance variable Foo(T aRef) {} // a constructor argument void bar(T aRef) {} // a method argument T baz() {} // a return type The compiler will substitute the actual type.
A class with default access can be seen only by ... A class with default access can be seen only by classes within the same package
A file can have more than one ... class A file can have more than one nonpublic class