package 课后四讲;
2
3 import javax.swing.JOptionPane;
4
5 class Example
6 {
7 static int value=0;
8 public Example()
9 {
10 value++;
11
12 }
13 }
14 public class Ckleigeshu {
15
16 public static void main(String[] args) {
17 Example section1=new Example();
18 Example section2=new Example();
19 Example section3=new Example();
20 String output="你已经创建了"+Example.value+"个对象";
21 JOptionPane.showMessageDialog(null, output,
22 "结果如下:",
23 JOptionPane.INFORMATION_MESSAGE );
24
25 }
26
27 }