Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 5th, 2015, 02:46 AM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #2 (permalink)  
Old August 7th, 2015, 02:38 PM
Authorized User
Points: 159, Level: 3
Points: 159, Level: 3 Points: 159, Level: 3 Points: 159, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Location: Romania
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
Reply With Quote
The Following User Says Thank You to Cristina For This Useful Post:
Bekjava (August 7th, 2015)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:11 PM.


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