Skip to content

Instantly share code, notes, and snippets.

@tsuzukihashi
Created April 20, 2019 03:54
Show Gist options
  • Save tsuzukihashi/0a52e6905b337debf1a54e3650d74773 to your computer and use it in GitHub Desktop.
Save tsuzukihashi/0a52e6905b337debf1a54e3650d74773 to your computer and use it in GitHub Desktop.
IDとNameを持ったメンバークラス
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