Wrox Programmer Forums
|
BOOK: Java Programming 24-Hour Trainer 2nd Edition
This is the forum to discuss the Wrox book Java Programming 24-Hour Trainer, 2nd Edition by Yakov Fain; ISBN: 978-1-118-95145-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Java Programming 24-Hour Trainer 2nd Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 5th, 2015, 02:46 AM
Registered User
 
Join Date: Aug 2015
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Default Lessons 6 & 7

Hi
I am fairly new to Java. Trying to learn on my own. Please help me with the following two questions:

(1) Why do we need to place the executable class in a separate package in both lessons 6 & 7?
(2) The subclasses(Employee, Contractor etc.) that implement the interface payable have a method declared as a Boolean that returns in "true" or "false". I tried to change the return values and there was no difference in the output. My question is when do we return true or false and why?

Thanks,
Bek
 
Old August 7th, 2015, 02:38 PM
Authorized User
 
Join Date: Feb 2012
Posts: 30
Thanks: 5
Thanked 4 Times in 4 Posts
Default

Hi Bek,

Indeed, the boolean return value of the increasePay method is not used in the program. To see a difference in the output determined by the result of increasePay, I modified the code in the main method as follows:

Code:
for (Person p: workers){
	        System.out.println(((Payable)p).increasePay(30)?"Done":"Failed");
	 		}
Regarding your first question, I think placing the class that contains the main method in a separate package is a matter of choice. You can organize the files in your project according to your own design. For example, if you want to change the location of the compiled classes in Eclipse, you can do so by selecting Project->Properties->Java Build Path->Source and modifying the name of the Default Output Folder.

Happy learning!

Cristina
The Following User Says Thank You to Cristina For This Useful Post:
Bekjava (August 7th, 2015)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Lessons 6 & 7 Bekjava BOOK: Java Programming 24-Hour Trainer by Yakov Fain 0 August 5th, 2015 01:21 AM
Lessons 33, 34 and 35 Coda BOOK: JavaScript 24-Hour Trainer 0 May 5th, 2015 02:00 PM
Recorded video lessons on Java yfain BOOK: Java Programming 24-Hour Trainer by Yakov Fain 0 October 9th, 2014 01:38 AM
Download of DVD Video Lessons SpeakToTheMike BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 1 February 6th, 2014 01:46 PM
Video lessons Ciupaz BOOK: Knight's 24-Hour Trainer: Microsoft SQL Server 2008 Integration Services 8 May 20th, 2013 08:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.