Advertisement
KodingKid

Java Inheritance - Basic Scripting #14

May 20th, 2021
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.31 KB | None | 0 0
  1. class Player {
  2.     protected String username = "username 1";
  3.     public void play() {
  4.         System.out.println("username 1 is playing a game");
  5.     }
  6. }
  7. class Person {
  8.     private String name = "person 1";
  9.     public void play() {
  10.         System.out.println("person 1 is also playing a game");
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement