正在加载图片...
The person class r We will use Person objects to illustrate the use of an array of objects. Person latter The Person class supports the set methods latte new Person()i and get methods latte setName(" Ms. Latte)i latte. setAge(20)i latte. set Gender(F)i outputBox. printLine(Name:+ latte getName() outputBox. printLine("Age : latte getAge( outputBox. printline(Sex : latte getGender ( C 2000 McGraw-Hill troduction to Object-Oriented Programming with Java--Wu Chapter 9-11© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 9 - 11 The Person Class We will use Person objects to illustrate the use of an array of objects. Person latte; latte = new Person( ); latte.setName("Ms. Latte"); latte.setAge(20); latte.setGender('F'); outputBox.printLine( "Name: " + latte.getName() ); outputBox.printLine( "Age : " + latte.getAge() ); outputBox.printLine( "Sex : " + latte.getGender() ); The Personclass supports the set methods and get methods
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有