Java/chapter2

ch03 UserInfo(생성자)

낭구리 2021. 8. 25. 14:03
package ch03;

public class UserInfo {

	String userId;
	String userPassWord;
	String userName;
	String userAddress;
	String phoneNumber;
	int age;

//	int userId;
//	int userPassWord;
//	int userName;
//	int userAddress;
//	int phoneNumber;

	// 7. int 형식 데이터 만들어서 생성자까지 만들기
	// 문제 1. 기본 생성자

	// 문제 2. userId값을 받는 생성자 만들기
	//생성자 오버로딩 문제 3번과 같이 userId, ~ phoneNumber 까지 하나하나쓰는것
	//alt sh S Generater ~ using
	
//	public UserInfo(String userId) {
//	super();
//	this.userId = userId;
//}
//
//	public UserInfo(String userId, String userPassWord) {
//		super();
//		this.userId = userId;
//		this.userPassWord = userPassWord;
//	}
//
//	public UserInfo(String userId, String userPassWord, String userName) {
//		super();
//		this.userId = userId;
//		this.userPassWord = userPassWord;
//		this.userName = userName;
//	}
	

	
	public UserInfo(String userId,String userPassWord,
			String userName,String userAddress,
			String phoneNumber,int age) {
		this.userId = userId;
		this.userPassWord = userPassWord;
		this.userName = userName;
		this.userAddress = userAddress;
		this.phoneNumber =phoneNumber;
		this.age = age;
	}





	// 문제 3. userId, userPassWord ~ phoneNumber



	//public UserInfo2(int userId,int userPassWord,
//		int userName,int userAddress,int phoneNumber) {
//	this.userId = userId;
//	this.userPassWord = userPassWord;
//	this.userName = userName;
//	this.userAddress = userAddress;
//	this.phoneNumber =phoneNumber;
//}
//
	public void Info() {
		System.out.println(userId);
		System.out.println(userPassWord);
		System.out.println(userName);
		System.out.println(userAddress);
		System.out.println(phoneNumber);

	}
}

'Java > chapter2' 카테고리의 다른 글

ch05 Student  (0) 2021.08.25
ch04 Student Bus Subway  (0) 2021.08.25
ch03 Person  (0) 2021.08.25
ch03 Bus  (0) 2021.08.25
ch02 FormainTest1  (0) 2021.08.25