The Java(tm) FAQ -- Classes, Interfaces, and Packages
Copyright
Table of Contents
Chapters:
1
2
3
4
5
6
7
8
9
10
11
Outline
Q1.1
What is an object?
See also: Q1.2, Q1.3, Q1.7
Q1.2
What is a class?
See also: Q1.1, Q1.3, Q1.7, Q1.12, Q1.20, Q1.32, Q2.19, JLS p. 38
Q1.3
What is a method?
See also: Q1.2, Q1.4, Q1.6, Q1.14, Q2.10
Q1.4
What is the signature of a method?
See also: Q1.13, Q1.14, Q2.24
Q1.5
What is the difference between an instance variable and a class variable?
See also: Q1.6
Q1.6
What is the difference between an instance method and a class method?
VariableExample.html
See also: Q1.2, Q1.3, Q1.5
Q1.7
How do I create an instance of a class?
See also: Q1.10, Q2.15, Q3.5, Q3.7, Q10.4, Q10.16
Q1.8
What is an abstract method?
See also: Q1.9, Q1.11
Q1.9
What is an abstract class?
See also: Q1.8, Q1.11, Q5.1
Q1.10
What is an object reference?
See also: Q2.8, JLS p. 39
Q1.11
What is a subclass?
See also: Q1.12, Q1.25
Q1.12
What is inheritance?
See also: Q1.5, Q1.6, Q5.1
Q1.13
What is an overloaded method?
See also: Q1.2, Q1.3, Q1.4, Q1.12, Q1.14
Q1.14
What does it mean to override a method?
OverrideMethodExample.html
See also: Q1.4, Q1.12, Q1.16, Q1.17, Q2.26, Q5.1, Q8.5
Q1.15
What is the difference between overloading and overriding?
See also: Q1.13, Q1.14, Q1.16
Q1.16
Can I override the equals method or clone
method from class Object to take a parameter or return a
value of the type that I specify?
See also: Q1.4, Q1.13, Q1.14, Q1.15, Q2.9
Q1.17
What is the super keyword used for?
SuperExample.html
See also: Q1.11, Q1.12
Q1.18
Does the Java language provide virtual methods, like C++?
See also: Q1.10, Q1.12, Q1.14, Q1.19, Q1.26
Q1.19
What is a final class?
See also: Q1.18
Q1.20
What is an interface?
See also: Q1.2, Q1.21, Q1.24, JLS pp. 186–188
Q1.21
How does a class implement an interface?
See also: Q1.9, Q1.20, Q1.22, Q9.16
Q1.22
Can I instantiate an interface?
InstantiateInterfaceExample.html
See also: Q1.7, Q1.20, Q1.21
Q1.23
Why does a method in an interface appear to be public even though I
didn't declare it to be public?
See also: Q1.8, Q1.20, Q1.32, JLS p. 187
Q1.24
How is an abstract class different from an interface?
See also: Q1.9, Q1.20, Q1.25
Q1.25
Does the Java language allow multiple inheritance?
See also: Q1.2, Q1.11, Q1.12, Q1.20
Q1.26
What is the instanceof keyword, and what does it do?
InstanceofExample.html
Q1.27
Why do I get the error message Can't access protected method
clone... when I try to clone an object?
See also: Q1.28, Q1.33
Q1.28
How do I design a class so that it supports cloning?
CloneExample.html
See also: Q1.27, Q1.32, Q1.33
Q1.29
What are packages, and what are they used for?
See also: Q1.2, Q1.20, Q1.30, Q1.32, JLS p. 119
Q1.30
I've seen both java.applet.Applet and Applet used to refer to the
Applet class -- what's the difference?
See also: Q1.29, Q1.31, JLS pp. 120ff
Q1.31
Why can I get some simple class names "for free," without using an
import declaration?
See also: Q1.29, Q1.30, JLS p. 119
Q1.32
Is there a default access modifier for classes and interfaces? For
class members (methods, constructors, and fields)?
See also: Q1.27, Q1.29, Q1.33
Q1.33
What does protected access mean?
See also: Q1.29, Q1.32, JLS p. 100
Q1.34
What is the accessibility of a public method or field inside a
nonpublic class or interface?
See also: Q1.18, Q1.29, Q1.32