Changes between Version 4 and Version 5 of jazz/21-09-22
- Timestamp:
- Oct 7, 2021, 4:32:46 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
jazz/21-09-22
v4 v5 19 19 20 20 - [[Image(OOP_Concepts.png)]] 21 22 {{{ 23 #!java 24 public class HelloWorld{ 25 26 public static void main(String []args){ 27 System.out.println("Hello World"); 28 29 Animal a = new Cat(); 30 Animal b = new Kitten(); 31 32 a.who_am_i(); 33 b.who_am_i(); 34 } 35 } 36 37 abstract class Animal { 38 abstract void who_am_i(); 39 } 40 41 class Cat extends Animal { 42 void who_am_i() { 43 System.out.println("I'm a Cat"); 44 } 45 } 46 47 class Kitten extends Cat { 48 void who_am_i() { 49 System.out.println("I'm a Kitten"); 50 } 51 } 52 }}}