Created
April 20, 2019 03:54
-
-
Save tsuzukihashi/0a52e6905b337debf1a54e3650d74773 to your computer and use it in GitHub Desktop.
IDとNameを持ったメンバークラス
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Member { | |
private int id; | |
private String name; | |
public Member(int id, String name){ | |
this.id = id; | |
this.name = name; | |
} | |
public Member(){ | |
this(0,"名無し"); | |
} | |
public int getId(){ | |
return this.id; | |
} | |
public void setId(int id){ | |
this.id = id; | |
} | |
public String getName(){ | |
return this.name; | |
} | |
public void setName(String name){ | |
this.name = name; | |
} | |
@Override | |
public String toString(){ | |
return "ID: " + this.id + "\t名前: " + this.name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment