구조 함수 실례화

2530 단어 구조 함수
package com.java1234.chap03.sec04;



public class People {

    

    //string      null

    private String name;

    //int       0;

    private int age;

    

    /*

     *       */

     People() {

        // TODO Auto-generated constructor stub

        System.out.println("      !");

    }

    

    /*

     *         

     */

    People(String name2,int age2){

        name=name2;

        age=age2;

        System.out.println("        !");

    }

    

    public void say(){

        System.out.println("  :"+name+",   :"+age);

    }    

    

    

    public static void main(String[] args) {

        People people=new People();

        People people2=new People("  ",23);

        people.say();

        people2.say();

    }



}




기본 구성 방법!파라미터가 있는 구조 방법!내 이름:null,나 올해:0나:장삼,나 올해:23
 

좋은 웹페이지 즐겨찾기