A Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) by Mughal Khalid A & Rasmussen Rolf W
Author:Mughal, Khalid A & Rasmussen, Rolf W [Mughal, Khalid A]
Language: eng
Format: azw3
Publisher: Pearson Education
Published: 2016-07-21T16:00:00+00:00
* * *
Example 7.14 Choosing the Most Specific Method (Simple Case)
Click here to view code image
class Light { /* ... */ }
class TubeLight extends Light { /* ... */ }
public class Overload {
boolean testIfOn(Light aLight) { return true; } // (1)
boolean testIfOn(TubeLight aTubeLight) { return false; } // (2)
public static void main(String[] args) {
TubeLight tubeLight = new TubeLight();
Light light = new Light();
Light light2 = new TubeLight();
Overload client = new Overload();
System.out.println(client.testIfOn(tubeLight)); // (3) ==> method at (2)
System.out.println(client.testIfOn(light)); // (4) ==> method at (1)
System.out.println(client.testIfOn(light2)); // (5) ==> method at (2)
}
}
Output from the program:
false
true
true
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Red Hat Certified Specialist in Services Management and Automation EX358 Exam Guide by Eric McLeroy(6143)
The KCNA Book by Nigel Poulton(4231)
Microsoft Security, Compliance, and Identity Fundamentals Exam Ref SC-900 by Dwayne Natwick(3601)
Designing and Implementing Microsoft Azure Networking Solutions by David Okeyode(3505)
Microsoft Security Operations Analyst Exam Ref SC-200 Certification Guide by Trevor Stuart and Joe Anich(3457)
Microsoft Security Operations Analyst Exam Ref SC-200 Certification Guide by Trevor Stuart & Joe Anich(3380)
TCP IP by Todd Lammle(2982)
Microsoft Power BI Data Analyst Certification Guide by Ed Corcoran Orrin Edenfield(2920)
Unity Certified Programmer: Exam Guide by Philip Walker(2554)
MCSA Windows Server 2016 Study Guide: Exam 70-740 by William Panek(2520)
Networking A Beginner's Guide by Bruce Hallberg(2209)
Microsoft Power Platform Solution Architect's Handbook by Hugo Herrera(2036)
31 Days Before Your CompTIA A+ Exams (Shanette Luellen's Library) by Benjamin Patrick Conry(1860)
CompTIA A+ Practice Tests Core 1 (220-1101) and Core 2 (220-1102) by Ian Neil and Mark Birch(1794)
MCSA Windows Server 2016 Study Guide: Exam 70-741 by William Panek(1666)
PHP 7 Zend Certification Study Guide by Andrew Beak(1644)
Healthcare Information Security and Privacy (All-In-One) by Sean Murphy(1551)
CompTIA A+ Certification Guide (220-901 and 220-902) by Matthew Bennett(1526)
RHCSA & RHCE Red Hat Enterprise Linux 7: Training and Exam Preparation Guide (EX200 and EX300), Third Edition by Asghar Ghori(1488)
