📘 Premium Read: Access my best content on Medium member-only articles — deep dives into Java, Spring Boot, Microservices, backend architecture, interview preparation, career advice, and industry-standard best practices.
✅ Some premium posts are free to read — no account needed. Follow me on Medium to stay updated and support my writing.
🎓 Top 10 Udemy Courses (Huge Discount): Explore My Udemy Courses — Learn through real-time, project-based development.
▶️ Subscribe to My YouTube Channel (172K+ subscribers): Java Guides on YouTube
implements Java Keyword Example
/**
* This represents payment interface
*/
interface Payment {
public void pay();
}
class CashPayment implements Payment {
// method overriding
@Override
public void pay() {
System.out.println("This is cash payment");
}
}
class CreditPayment implements Payment {
// method overriding
@Override
public void pay() {
System.out.println("This is credit card payment");
}
}
interface A {
}
interface B {
}
class C implements A, B {
}
Summary
- A single class may implement multiple interfaces.
- If the implemented class does not provide an implementation for the interface's methods, the class must be abstract.
Comments
Post a Comment
Leave Comment