Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package inhert;
- public class Main {
- public static void main(String[] args) {
- Player p1 = new Player();
- p1.Output();
- System.out.println("\n");
- Player p2 = new Player(
- "Bob",
- "Captain",
- "No",
- 1234,
- (short)99,
- (short)12,
- 18.9f);
- p2.Output();
- System.out.println("\n Subclass: \n");
- PlayerV2 pv1 = new PlayerV2();
- pv1.Output();
- System.out.println("\n");
- PlayerV2 pv2 = new PlayerV2(
- "Bob",
- "Captain",
- "No",
- 1234,
- (short)99,
- (short)12,
- 18.9f,
- (short) 6,
- (short) 100,
- (short) 50,
- (int) 1000,
- "Team Snake");
- pv2.Output();
- System.out.println("\n");
- System.out.println(pv1.getRankAndName());
- System.out.println(pv2.getRankAndName());
- }
- }
- // don't inherit constructors
- // java dosn't support multiple inheritance
- // new = new memory for an object
- // superclass first sub class is second
- // dont use colon but use extend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement