Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ContohAbstractInterface;
- public abstract class AbstraksiAnjay {
- public abstract void berubah();
- public void bergabung(){
- System.out.println("Menjadi Robot Raksasa");
- }
- }
- class rangerMerah extends AbstraksiAnjay{
- @Override
- public void berubah() {
- System.out.println("Berubah Ranger Merah");
- }
- }
- class rangerHijau extends AbstraksiAnjay{
- @Override
- public void berubah() {
- System.out.println("Berubah Rangers Hijau");
- }
- }
- class exekusi{
- public static void main(String[] args) {
- AbstraksiAnjay red = new rangerMerah();
- AbstraksiAnjay green = new rangerHijau();
- red.berubah();red.bergabung();
- green.berubah();green.bergabung();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement