29 0xCA, 0xFE, 0xBA, 0xBE, 0x00, minor, 0x00, major |
28 0xCA, 0xFE, 0xBA, 0xBE, 0x00, minor, 0x00, major |
30 |
29 |
31 Access modifiers. |
30 Access modifiers. |
32 ================= |
31 ================= |
33 |
32 |
34 Public. |
33 ``public``: |
35 ------- |
|
36 |
34 |
37 * Public class is visible in other packages. |
35 * Public class is visible in other packages. |
38 * Public field is visible everywhere (class must be public too). |
36 * Public field is visible everywhere (class must be public too). |
39 |
37 |
40 Private. |
38 ``private``: |
41 -------- |
|
42 |
39 |
43 * Private variables or methods may be used only by an instance of the same |
40 * Private variables or methods may be used only by an instance of the same |
44 class that declares the variable or method |
41 class that declares the variable or method |
45 * A private feature may only be accessed by the class that owns the feature. |
42 * A private feature may only be accessed by the class that owns the feature. |
46 |
43 |
47 Protected. |
44 ``protected``: |
48 ---------- |
|
49 |
45 |
50 * Is available to all classes in the same package and also available to all |
46 * Is available to all classes in the same package and also available to all |
51 subclasses of the class that owns the protected feature. |
47 subclasses of the class that owns the protected feature. |
52 * This access is provided even to subclasses that reside in a different |
48 * This access is provided even to subclasses that reside in a different |
53 package from the class that owns the protected feature. |
49 package from the class that owns the protected feature. |
54 |
50 |
55 default. |
51 Default (ie, without any access modifier): |
56 -------- |
|
57 |
|
58 What you get by default ie, without any access modifier. |
|
59 |
52 |
60 * It means that it is visible to all within a particular package. |
53 * It means that it is visible to all within a particular package. |
61 |
54 |
62 static. |
55 static. |
63 ------- |
56 ------- |
231 |
224 |
232 $ jps -l -v |
225 $ jps -l -v |
233 |
226 |
234 Save dump to file:: |
227 Save dump to file:: |
235 |
228 |
236 $ jmap -dump:format=b,file=heap.dump $PID |
229 $ jmap -dump:format=b,file=heap.hprof $PID |
|
230 $ sudo -u $USR jcmd $PID GC.heap_dump heap.hprof |
237 |
231 |
238 With ``live`` option only reachable objects are dumped:: |
232 With ``live`` option only reachable objects are dumped:: |
239 |
233 |
240 $ jmap -dump:live,format=b,file=heap.dump $PID |
234 $ jmap -dump:live,format=b,file=heap.hprof $PID |
241 |
235 |
242 Creating heap dump on OutOfMemory error |
236 Creating heap dump on OutOfMemory error |
243 ======================================= |
237 ======================================= |
244 |
238 |
245 Run Java application with:: |
239 Run Java application with:: |