从codes学java tiger之varargs

Posted on 2006-06-26 20:25 BlueO2 阅读(370) 评论(0)  编辑  收藏 所属分类: JAVA foundation
public   class  Artist  {
    
    String[] others;
    
/**  Creates a new instance of Artist  */
    
public  Artist()  {
    }

    
public  Artist(String name,String  others) {
        
for (String other : others) {
            System.out.println(other);
        }

        
this .others  =  others;
    }

    
public   void  wildestMethod(Object  objs) {
    
// this method will accept any arguments
    }

    
public   static   void  main(String[] args) {
        Artist artist 
=   new  Artist( " You " " 1 " " 2 " );
        artist.wildestMethod(
1 3.5 " AA " new  Artist());
    }

    
}

只有注册用户登录后才能发表评论。


网站导航:
 

posts - 29, comments - 3, trackbacks - 0, articles - 0

Copyright © BlueO2