Exercise 3 (page 2)Make an executable class called Exercise3, with main method create 3 objects of type Animal called animal1, animal2, animal3 assign animal1 type Dog, age 3; increment age using set/get; ask to talk assign animal2 type Cat, age 4; decrement age using set/get; ask to talk ask animal3 to talk display true/false for: 1) animal1 of type Animal; 2) animal2 of type Dog display who is oldest, animal1 or animal2
Dog at age 4 says... WUF-WUF! Cat at age 3 says... MIEW-MIEW! unknown type at age 0 says... animal1 of same type as Animal: true animal2 of same type as Dog: false Comparing animal1 and animal2: 1
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库JAVE基础实验 Experiment3(5)在线全文阅读。
相关推荐: