⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chapter3n1.java

📁 JAVA源代码程序aashjkjhkjhkjhjkhkj
💻 JAVA
字号:
/** * * demonstration of the manipulation of "Person" objects * * Written by: Roger Garside * * First Written: 12/June/96 * Last Rewritten: 2/Oct/96 * */import java.lancs.* ;public class Chapter3n1    {    /**     *     * main     *     */    public static void main(String[] args)        {        // step 1 - declare two "Person" variables        Person person1 = new Person() ;        Person person2 = new Person() ;        // step 2 - set the attributes of "person1"        person1.setForename("John") ;        person1.setSurname("Smith") ;        person1.setAge(24) ;        // step 3 - set the attributes of "person2"        person2.setForename("Peter") ;        person2.setSurname("Wright") ;        person2.setAge(19) ;        // step 4 - display the attributes of "person2"        System.out.print("the second person is ") ;        System.out.print(person2.getForename()) ;        System.out.print(" ") ;        System.out.print(person2.getSurname()) ;        System.out.print(" (") ;        System.out.print(person2.getAge()) ;        System.out.println(")") ;        // step 5 - leave a blank line        System.out.println() ;            // step 6 - display the attributes of "person1"        System.out.print("the first person is ") ;        System.out.print(person1.getForename()) ;        System.out.print(" ") ;        System.out.print(person1.getSurname()) ;        System.out.print(" (") ;        System.out.print(person1.getAge()) ;        System.out.println(")") ;        } // end of method main    } // end of class Chapter3n1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -