1 / 5

People Application

People Application. Project name: People Package name: org.notborder.people. Parent, Teacher and Person classes are abstract ( 추상 ) love() method in the Person class is abstract. 추상 매소드. 상위 클레스에서 정의된 추상 매소드를 추상 아닌 하위 클레스에서 반드시 구현해야. Polymorphism. Add Main class with main method

talon
Download Presentation

People Application

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. People Application • Project name: People • Package name: org.notborder.people

  2. Parent, Teacher and Person classes are abstract (추상) love() method in the Person class is abstract

  3. 추상 매소드 • 상위 클레스에서 정의된 추상 매소드를 추상 아닌 하위 클레스에서 반드시 구현해야

  4. Polymorphism • Add Main class with main method • create ArrayList<Person> • create 1 object for each concrete class and add to the ArrayList • use ‘for’ loop to call ‘잔소리’, ‘love’ and ‘hit’ methods for all objects (use ‘instanceof’ operator test before calling the hit method)

  5. Output • 잔소리method prints 하지 마라요 • love method prints 선생님: 숙재를 줘요for the Teacher classes, 엄마: 밥을 줘요 for the 엄마 class, and 아빠: 돈을 줘요 for the 아빠 class • hit method prints Please don't hit me, 아빠!, Please don't hit me, 엄마! and Please don't hit me, 선생님! for the relevant classes

More Related