KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > debugger > jpda > testapps > MethodBreakpointApp


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.api.debugger.jpda.testapps;
21
22 /**
23  * Sample method breakpoints application. DO NOT MODIFY - line numbers must not change in this source file.
24  *
25  * @author Maros Sandor
26  */

27 public class MethodBreakpointApp {
28
29     public static void main(String JavaDoc[] args) {
30         MethodBreakpointApp sa = new MethodBreakpointApp();
31         sa.a();
32         sa.b();
33         sa.c();
34         new InnerStatic().getW();
35         new ConcreteInner().compute(); new ConcreteInner().getString();
36     }
37     static {
38         System.currentTimeMillis();
39     }
40
41     public MethodBreakpointApp() {
42         System.currentTimeMillis();
43     }
44
45     private void a() {
46         b();
47         c();
48     }
49
50     private void b() {
51         c();
52     }
53
54     private void c() {
55         Inner i = new Inner(); i.getW(); i.getW();
56     }
57
58     private static class InnerStatic {
59
60         private static int q = 0;
61
62         static {
63             q ++;
64         }
65
66         private int w = 1;
67
68         {
69             w ++;
70         }
71
72         public InnerStatic() {
73             w ++;
74         }
75
76         public static int getQ() {
77             return q;
78         }
79
80         public int getW() {
81             return w;
82         }
83     }
84
85     private class Inner {
86
87         private int w = 1;
88
89         {
90             w ++;
91         }
92
93         public Inner() {
94             w ++;
95         }
96
97         public int getW() {
98             return w;
99         }
100     }
101     
102     private static abstract class AbstractInner {
103         
104         public abstract double compute();
105         
106     }
107     
108     private static interface InterfaceInner {
109         
110         String JavaDoc getString();
111         
112     }
113     
114     private static class ConcreteInner extends AbstractInner implements InterfaceInner {
115         
116         public double compute() {
117             double num = Math.PI/2;
118             return Math.round(Math.sin(num)*1000)/1000.0;
119         }
120         
121         public String JavaDoc getString() {
122             char[] chars = new char[] { 'H', 'e', 'l', 'l', 'o' };
123             return new String JavaDoc(chars);
124         }
125         
126     }
127
128 }
129
Popular Tags