07 Java Classes Pt6
07 Java Classes Pt6
Interface
Abstract
Class
See docs.oracle.com/javase/tutorial/java/IandI/abstract.html
2
package java.util;
public abstract class
AbstractMap<K,V> ... {
...
public abstract
Set<Entry<K,V>> entrySet();
...
package java.util;
public abstract class
AbstractMap<K,V> ... {
...
public abstract
Set<Entry<K,V>> entrySet();
...
package java.util;
public abstract class
AbstractMap<K,V> ... {
...
volatile Set<K> keySet;
volatile Collection<V> values;
...
package java.util;
public abstract class
AbstractMap<K,V> ... {
...
volatile Set<K> keySet;
volatile Collection<V> values;
...
package java.util;
public abstract class
AbstractMap<K,V> ... {
...
public V put(K key, V value) {
...
}
protected Object clone()
{ ... }
private static boolean eq
(Object o1, Object o2)
{ ... }
...
10
See javapapers.com/core-java/why-multiple-inheritance-is-not-supported-in-java
11
Importing Classes
& Creating Classes
12
Importing Classes
package java.util;
public class Arrays {
public static <T> T[]
copyOf(T[] original,
int newLength) {
...
public class Vector<E> {
public Object clone() {
...
Object[] v =
Arrays.copyOf(mData,
mCount);
...
13
Importing Classes
package java.util;
public class Arrays {
public static <T> T[]
copyOf(T[] original,
int newLength) {
...
public class Vector<E> {
public Object clone() {
...
Object[] v =
Arrays.copyOf(mData,
mCount);
...
14
Importing Classes
15
Importing Classes
package java.util.concurrent;
public class
ConcurrentHashMap<K,V>
extends
java.util.AbstractMap<K,V>
...
Importing Classes
package java.util.concurrent;
import java.util.AbstractMap;
...
public class
ConcurrentHashMap<K,V>
extends
AbstractMap<K,V>
...
17
Importing Classes
package java.util.concurrent;
import java.util.AbstractMap;
...
public class
ConcurrentHashMap<K,V>
extends
AbstractMap<K,V>
...
Note succinct
class declaration
18
Importing Classes
package java.util.concurrent;
import java.util.AbstractMap;
...
public class
ConcurrentHashMap<K,V>
extends
AbstractMap<K,V>
...
19
Importing Classes
package java.util.concurrent;
import java.util.AbstractMap;
...
public class
ConcurrentHashMap<K,V>
extends
AbstractMap<K,V>
...
20
Overview of Java
Exception Handling
21
See en.wikipedia.org/wiki/Murphys_law
22
23
24
25
See en.wikipedia.org/wiki/Exception_handling
26
See eskatos.wordpress.com/2009/09/30/how-is-exception-handling-implemented-in-jvms
27
28
29
See docs.oracle.com/javase/tutorial/essential/exceptions/throwing.html
30
31
32
33
34
35
method1()
calls
Call Stack
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
36
method1()
calls
Call Stack
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
37
method1()
calls
Call Stack
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
38
method1()
calls
Call Stack
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
39
method1()
calls
Call Stack
Throws
IOException
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
40
method1()
calls
Call Stack
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
41
method1()
calls
Call Stack
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
42
method1()
calls
Call Stack
method2() throws
IOException {}
calls
method3() throws
IOException {}
calls
method4() throw
IOException {}
43
Catches
IOException
See docs.oracle.com/javase/tutorial/essential/exceptions/try.html
44
See docs.oracle.com/javase/tutorial/essential/exceptions/try.html
45
46
47
See docs.oracle.com/javase/tutorial/essential/exceptions/catch.html
48
See docs.oracle.com/javase/tutorial/essential/exceptions/catch.html
49
50
51
See docs.oracle.com/javase/tutorial/essential/exceptions/finally.html
52
53
See docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
54
55
56
bufReader is automatically
closed when the block exits
57
58
59
60
61
62
63
64
65
66
67
68
69
70
See developer.android.com/reference/java/lang/Exception.html
71
See developer.android.com/reference/java/lang/Throwable.html
72
See developer.android.com/reference/java/lang/Throwable.html#printStackTrace()
73
74
Checked exceptions
See en.wikibooks.org/wiki/Java_Programming/Checked_Exceptions
75
Checked exceptions
76
Checked exceptions
77
Checked exceptions
78
Checked exceptions
Unchecked exceptions
See docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html
79
Checked exceptions
Unchecked exceptions
80
Checked exceptions
Unchecked exceptions
81
Checked exceptions
Unchecked exceptions
82
Checked exceptions
Unchecked exceptions
83
Checked exceptions
Unchecked exceptions
84
Checked exceptions
Unchecked exceptions
85
See docs.oracle.com/javase/tutorial/essential/exceptions
86
Overview of Java
Garbage Collection
87
88
See en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Advantages
89
90
See en.wikipedia.org/wiki/Garbage_collection_(computer_science)#Disadvantages
91
92
See www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01
93