176
|
1 |
-*- outline -*-
|
|
2 |
|
|
3 |
* Class version.
|
|
4 |
|
|
5 |
See value of 6 and 8 bytes in .class file:
|
|
6 |
|
|
7 |
{0xCA, 0xFE, 0xBA, 0xBE, 0x00, minor, 0x00, major}
|
|
8 |
|
|
9 |
major minor Java platform version
|
|
10 |
45 3 1.0
|
|
11 |
45 3 1.1
|
|
12 |
46 0 1.2
|
|
13 |
47 0 1.3
|
|
14 |
48 0 1.4
|
|
15 |
49 0 1.5
|
|
16 |
50 0 1.6
|
267
|
17 |
|
|
18 |
* Modifiers.
|
|
19 |
|
|
20 |
** public.
|
|
21 |
|
|
22 |
* Public class is visible in other packages.
|
|
23 |
* Public field is visible everywhere (class must be public too).
|
|
24 |
|
|
25 |
** private.
|
|
26 |
|
|
27 |
* Private variables or methods may be used only by an instance of the same
|
|
28 |
class that declares the variable or method
|
|
29 |
* A private feature may only be accessed by the class that owns the feature.
|
|
30 |
|
|
31 |
** protected.
|
|
32 |
|
|
33 |
* Is available to all classes in the same package and also available to all
|
|
34 |
subclasses of the class that owns the protected feature.
|
|
35 |
* This access is provided even to subclasses that reside in a different
|
|
36 |
package from the class that owns the protected feature.
|
|
37 |
|
|
38 |
** default.
|
|
39 |
|
|
40 |
What you get by default ie, without any access modifier.
|
|
41 |
|
|
42 |
* It means that it is visible to all within a particular package.
|
|
43 |
|
|
44 |
* static.
|
|
45 |
|
|
46 |
* Static means one per class, not one for each object no matter how many
|
|
47 |
instance of a class might exist. This means that you can use them without
|
|
48 |
creating an instance of a class.
|
|
49 |
* Static methods are implicitly final, because overriding is done based on
|
|
50 |
the type of the object, and static methods are attached to a class, not an
|
|
51 |
object.
|
|
52 |
* A static method in a superclass can be shadowed by another static method in
|
|
53 |
a subclass, as long as the original method was not declared final.
|
|
54 |
* You can't override a static method with a nonstatic method.
|
|
55 |
|
|
56 |
* final.
|
|
57 |
|
|
58 |
* A final class can't be extended ie., final class may not be subclassed.
|
|
59 |
* A final method can't be overridden when its class is inherited.
|
|
60 |
* You can't change value of a final variable.
|
|
61 |
|
|
62 |
* Exceptions.
|
|
63 |
|
|
64 |
A checked exception is some subclass of Exception (or Exception itself),
|
|
65 |
excluding class RuntimeException and its subclasses.
|
|
66 |
|
|
67 |
Unchecked exceptions are RuntimeException and any of its subclasses. Class
|
|
68 |
Error and its subclasses also are unchecked. With an unchecked exception,
|
|
69 |
however, the compiler doesn't force client programmers either to catch the
|
|
70 |
exception or declare it in a throws clause.
|
|
71 |
|
|
72 |
* Inner classes.
|
|
73 |
|
|
74 |
** Nested top-level classes.
|
|
75 |
|
|
76 |
If you declare a class within a class and specify the static modifier, the
|
|
77 |
compiler treats the class just like any other top-level class.
|
|
78 |
|
|
79 |
Any class outside the declaring class accesses the nested class with the
|
|
80 |
declaring class name acting similarly to a package. eg, outer.inner. Top-level
|
|
81 |
inner classes implicitly have access only to static variables. There can also
|
|
82 |
be inner interfaces. All of these are of the nested top-level variety.
|
|
83 |
|
|
84 |
** Member classes.
|
|
85 |
|
|
86 |
Member inner classes are just like other member methods and member variables
|
|
87 |
and access to the member class is restricted, just like methods and variables.
|
|
88 |
This means a public member class acts similarly to a nested top-level class.
|
|
89 |
|
|
90 |
The primary difference between member classes and nested top-level classes is
|
|
91 |
that member classes have access to the specific instance of the enclosing
|
|
92 |
class.
|
|
93 |
|
|
94 |
** Local classes.
|
|
95 |
|
|
96 |
Local classes are like local variables, specific to a block of code. Their
|
|
97 |
visibility is only within the block of their declaration. In order for the
|
|
98 |
class to be useful beyond the declaration block, it would need to implement a
|
|
99 |
more publicly available interface.
|
|
100 |
|
|
101 |
Because local classes are not members, the modifiers public, protected,
|
|
102 |
private, and static are not usable.
|
|
103 |
|
|
104 |
** Anonymous classes.
|
|
105 |
|
|
106 |
Anonymous inner classes extend local inner classes one level further. As
|
|
107 |
anonymous classes have no name, you cannot provide a constructor.
|
|
108 |
|
305
|
109 |
* 64-bit problem.
|
267
|
110 |
|
305
|
111 |
http://www.java.com/en/download/faq/java_win64bit.xml
|
|
112 |
Which version of Java should I download for my 64-bit Windows
|
|
113 |
operating system?
|
|
114 |
http://java.sun.com/javase/6/webnotes/install/system-configurations.html
|
|
115 |
Java� SE 6 Release Notes Supported System Configurations
|
267
|
116 |
|