class Ideone
{
{
Train2 ko = new Train2(50);
Express azusa = new Express(100);
run(ko);
run(azusa);
}
public static void run(Train2 t) {
t.up();
t.print();
}
}
// your code goes here
class Train {
public int speed;
public void up() {
speed += 1;
}
public void down() {
speed -= 1;
}
}
class Train2 {
protected int speed;
public Train2(int s) {
this.speed = s;
}
public int getSpeed() {
return speed;
}
public void up() {
speed += 1;
}
public void print() {
}
}
class Express extends Train2 {
public Express(int ss) {
super(ss);
System.
out.
println("Express"); }
public void up() {
speed += 5;
}
}
CmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCiAgICAgICAgVHJhaW4yIGtvID0gbmV3IFRyYWluMig1MCk7CiAgICAgICAgRXhwcmVzcyBhenVzYSA9IG5ldyBFeHByZXNzKDEwMCk7CiAgICAgICAgcnVuKGtvKTsKICAgICAgICBydW4oYXp1c2EpOwogICAgfQoKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBydW4oVHJhaW4yIHQpIHsKICAgICAgICB0LnVwKCk7CiAgICAgICAgdC5wcmludCgpOwogICAgfQp9Ci8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCmNsYXNzIFRyYWluIHsKICAgIHB1YmxpYyBpbnQgc3BlZWQ7CgogICAgcHVibGljIHZvaWQgdXAoKSB7CiAgICAgICAgc3BlZWQgKz0gMTsKICAgIH0KCiAgICBwdWJsaWMgdm9pZCBkb3duKCkgewogICAgICAgIHNwZWVkIC09IDE7CiAgICB9Cn0KY2xhc3MgVHJhaW4yIHsKICAgIHByb3RlY3RlZCBpbnQgc3BlZWQ7CgogICAgcHVibGljIFRyYWluMihpbnQgcykgewogICAgICAgIHRoaXMuc3BlZWQgPSBzOwogICAgfQoKICAgIHB1YmxpYyBpbnQgZ2V0U3BlZWQoKSB7CiAgICAgICAgcmV0dXJuIHNwZWVkOwogICAgfQoKICAgIHB1YmxpYyB2b2lkIHVwKCkgewogICAgICAgIHNwZWVkICs9IDE7CiAgICB9CgogICAgcHVibGljIHZvaWQgcHJpbnQoKSB7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKHNwZWVkKTsKICAgIH0KfQoKY2xhc3MgRXhwcmVzcyBleHRlbmRzIFRyYWluMiB7CiAgICBwdWJsaWMgRXhwcmVzcyhpbnQgc3MpIHsKICAgICAgICBzdXBlcihzcyk7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKCJFeHByZXNzIik7ICAgICAgICAKICAgIH0KCiAgICBwdWJsaWMgdm9pZCB1cCgpIHsKICAgICAgICBzcGVlZCArPSA1OwogICAgfQoKICAgIH0KCg==