六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 55|回复: 0

[转]用一个代码分析~~~ java 执行过程(1)

[复制链接]

升级  11.33%

17

主题

17

主题

17

主题

秀才

Rank: 2

积分
67
 楼主| 发表于 2013-1-15 03:13:49 | 显示全部楼层 |阅读模式
请看下面文章的朋友注意字体的颜色,下面的 解释 和上面的 注释 是一一对应的~~~~呵呵!

有什么错误还请留言,还望不吝赐教!!! 

如果你在看的时候 或者 ,呵呵

还请在看之前,自己先运行一下代码,这样有你就会了,呵呵    





<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee;"> 1 public   class  Test3  extends  Test4 
 2
 3      {
 4         System.out.print( " " );  // 子类中的动态方法
 5     }  
 6
 7     Test3()
 8      {
 9         System.out.print( " " );    // 子类中函数的方法
10         System.out.print( " " );   
11     }  
12
13      static
14      {
15         System.out.print( " " );     // 子类中的静态方法
16     }  
17
18      {
19         System.out.print( " " );     // 子类中的动态方法
20     }  
21
22      public   static   void  main(String[] args)
23      {
24         System.out.print( " " );      // main中函数
25         
26          new  Test3();
27        /**/ /* 这里在main中创建和调用本类方法  */
28         
29         System.out.print( " " );    // main中函数
30     }
31     
32      {
33      
34      System.out.print( " " );       // main函数中的动态方法
35      
36      }
37     
38      static
39      {
40         System.out.print( " " );    // main函数中的静态方法
41     }
42 }  
43
44
45 class  Test4 
46 {
47     
48      {
49        System.out.print( " " );   // 父类中的动态方法
50     }  
51     
52     Test4()
53      {
54         System.out.print( " " );   // 父类中函数的方法
55     }
56     
57     Test4( int  i)
58      {
59         System.out.print( " 没传参数 没有打印出来  " );  
60     }
61     
62      static
63      {
64         System.out.print( " " );    // 父类中的静态方法
65     }
66     
67      {
68         System.out.print( " " );    // 父类中的动态方法
69     }
70     
71      static
72      {
73         System.out.print( " " );    // 父类中的静态方法
74     }
75     
76 }
77
78
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表