Skip to content

Instantly share code, notes, and snippets.

@takuma7
Created December 16, 2011 02:14
Show Gist options
  • Save takuma7/1484112 to your computer and use it in GitHub Desktop.
Save takuma7/1484112 to your computer and use it in GitHub Desktop.
import Mondai14_2.java;
abstract class Student{
void study(int hour){
System.out.println("studied at home for " + hour + "hour(s).");
}
abstract void work(int hour);
}
class Pattern1 extends Student{
void work(int hour){
Convenience cv = new Convenience();
cv.calc(hour);
cv.hyouji();
}
}
class Pattern2 extends Student{
void work(int hour){
System.out.println("gave a help for " + hour + " hour(s).");
}
}
class Mondai14_3{
public static void main(String[] args){
Pattern1 tomoko = new Pattern1();
Pattern1 tatsuhiro = new Pattern1();
Pattern2 nobuyasu = new Pattern2();
tomoko.work(3);
tomoko.study(3);
tatsuhiro.work(5);
tatsuhiro.study(1);
nobuyasu.work(2);
nobuyasu.study(5);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment