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

📄 chapter10n0.java

📁 JAVA源代码程序aashjkjhkjhkjhjkhkj
💻 JAVA
字号:
/** * * demonstration of modified "OurPerson" class * */import java.lancs.* ;public class Chapter10n0    {    public static void main(String[] args)	{	OurPerson aPerson = new OurPerson("James", "Kirk", 32, OurPerson.MALE) ;	// set up the person's birthdate	OurDate birthday = new OurDate(1957, 3, 8) ;	aPerson.setDateOfBirth(birthday) ;	displayPerson(aPerson) ;	System.out.println() ;	birthday.setMonth(6) ;	displayPerson(aPerson) ;	System.out.println() ;	System.out.println(birthday) ;	incrementMonth(birthday) ;	System.out.println(birthday) ;	} // end of main method    private static void displayPerson(OurPerson person)        {	System.out.print(person.getForename()) ;	System.out.print(' ') ;	System.out.print(person.getSurname()) ;	System.out.print(' ') ;	System.out.print(person.getAge() + " ") ;	OurDate tDate = person.getDateOfBirth() ;	System.out.print(tDate.getDayOfMonth() + "/" +		tDate.getMonth() + "/" + tDate.getYear()) ;        } // end of method displayPerson    public static void incrementMonth(OurDate d)	{	int month = d.getMonth() ;	month = month + 1 ;	if (month > OurDate.DEC)	    {	    System.out.println("oops!") ;	    System.exit(0) ;	    }	d.setMonth(month) ;	} // end of method incrementMonth    } // end of class Chapter10n0

⌨️ 快捷键说明

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