[자바] 주소록 프로그램 소스 1단계

package IdontStudyJava;

public class PhoneInfo {

 private String name;
 private String phoneNumber;
 private String birthday;
 
 public PhoneInfo(String name, String phoneNumber,String birthday){
  this.name =name;
  this.phoneNumber = phoneNumber;
  this.birthday = birthday;
 }
 public PhoneInfo(String name, String phoneNumber){
  this(name,phoneNumber,"No info");
 }
 
 public void printInfo()
 {
  System.out.println(this.name);
  System.out.println(this.phoneNumber);
  System.out.println(this.birthday);
  System.out.println("");
  
 }
 
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  PhoneInfo info1 = new PhoneInfo("Kim","010-6244-4943","891103");
  PhoneInfo info2 = new PhoneInfo("Lee","010-3494-4943");
  info1.printInfo();
  info2.printInfo();
  
 }

}

이 글을 공유하기

댓글

Designed by JB FACTORY