随笔 - 382  文章 - 14  评论 - 509 

public class Insect {
        
int i=9;
        
int j;
        Insect()
        
{
            prt(
"i="+i+",j="+j);
            j
=39;
            
        }

        
static int x1=prt("static Insect.x1 initallize");
        
static int prt(String s)
        
{
            System.out.println(s);
            
return 47;
        }

        
}


public class Beetle extends Insect {
    
int k=prt("Beetle.k initialized");
    Beetle()
    
{
        prt(
"k="+k);
        prt(
"j="+j);
        
    }

    
static int x2=prt("static Beetle.x2 initialize");
    
static int prt(String s)
    
{
        System.out.println(s);
        
return 63;
    }

    
/**
     * 
@param args
     
*/

    
public static void main(String[] args) {
        
// TODO 自动生成方法存根
        prt("Beetle constructor");
        Beetle b
=new Beetle();
    }


}

运行结果:

Code
posted on 2008-03-13 21:53 玉米丰收 阅读(52) 评论(0)  编辑 收藏 网摘 所属分类: ×JAVA×

标题  
姓名  
主页
Email (博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交      
Google站内搜索
[推荐职位]上海盛大网络招聘架构师



China-pub 计算机图书网上专卖店!6.5万品种 2-8折!
近千种 9-95 新二手计算图书火热销售中!
开发者征途系统新作:《设计模式——基于C#的工程化实现及扩展》

相关文章:

相关链接: