Skip to content

Instantly share code, notes, and snippets.

@miio
Created June 20, 2011 18:30
Show Gist options
  • Save miio/1036227 to your computer and use it in GitHub Desktop.
Save miio/1036227 to your computer and use it in GitHub Desktop.
NightPeoples
public class NightPeoples {
public static void main(String[] args) {
// TODO Auto-generated method stub
class HHiro{
protected String name="エッチ・ナ・ヒロ";
@Override
public String toString(){
return name;
}
}
class Miio{
protected String name="エッチ・ナ・ミイオ";
@Override
public String toString(){
return name;
}
}
class NightPeople{
protected String name="";
@Override
public String toString(){
return "\夜の"+name+"/";
}
}
class NightHHiro extends NightPeople{
public NightHHiro(){
name = new HHiro().toString();
}
}
class NightMiio extends NightPeople{
public NightMiio(){
name = new Miio().toString();
}
}
List<NightPeople> hPeoples = new ArrayList<NightPeople>();
hPeoples.add(new NightMiio());
hPeoples.add(new NightHHiro());
for(NightPeople h: hPeoples){
System.out.println(h);
}
//Result:
// \夜のエッチ・ナ・ミイオ/
// \夜のエッチ・ナ・ヒロ/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment