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

📄 chapter4n1a.java

📁 JAVA源代码程序aashjkjhkjhkjhjkhkj
💻 JAVA
字号:
/* * program to demonstrate a simple "if" statement */import java.lancs.* ;public class Chapter4n1a    {    /*     * main     */    public static void main(String[] args) throws Exception	{	// read in values for the Person attributes	BasicIo.prompt("please type in the forename ") ;	String forename = BasicIo.readString() ;	BasicIo.prompt("please type in the surname ") ;	String surname = BasicIo.readString() ;	BasicIo.prompt("please type in the age ") ;        int age = BasicIo.readInteger() ;	BasicIo.prompt("please type in the gender ") ;        String response = BasicIo.readString() ;        int gender ;        if (response.equalsIgnoreCase("male"))            gender = Person.MALE ;        else if (response.equalsIgnoreCase("female"))            gender = Person.FEMALE ;        else            gender = Person.UNKNOWN ;        Person person1 = new Person(forename, surname, age, gender) ;        // output some information about the Person        System.out.print(person1.getForename() + ' ' + person1.getSurname()) ;        System.out.print(" is " ) ;        if (person1.getAge() > 18)	    System.out.print("an adult") ;        else	    System.out.print("a minor") ;        System.out.println() ;	} // end of method main    } // end of class Chapter4n1a

⌨️ 快捷键说明

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