Skip to Main Content
Java
book

Java

by Michael Sikora
January 2003
Beginner to intermediate content levelBeginner to intermediate
150 pages
7h 28m
English
Morgan Kaufmann
Content preview from Java
60
Chapter 5: Inheritance and Access Control []
PerformTransaction
1 interface PerformTransaction {
2 public void deposit (double amount);
3 public double withdraw (double amount);
4 }
PerformTran saction
Note that all methods in an interface are public by default; we have chosen to make this explicit.
An interface is not a class, so we do not have a corresponding object. Any class can choose to
implement the PerformTransaction interface where it makes sense to have deposit and withdraw
methods. To implement an interface, include the implements interface_name keyword in the
class declaration, for example,
class InvestmentFund ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Programming

Java Programming

Poornachandra Sarang
JAVA Programming

JAVA Programming

K. Rajkumar
Java Programming

Java Programming

Hari Mohan Pandey
Java 9 for Programmers

Java 9 for Programmers

Paul J. Deitel, Harvey Deitel

Publisher Resources

ISBN: 9781558609099