About this document
Java Programming Lab Exercises by Venkatesh Venkatesh is a document available to read on EtoBox.
Here is a Java program to create an interface with two methods and implement it in another class: 1. interface A { 2. public void meth1(); 3. public void meth2(); 4. } 5. public class B implements A { 6. public void meth1() { 7. System.out.println("Method 1 implemented"); 8. } 9. public void meth2() { 10. System.out.println("Method 2 implemented"); 11. } 12. public static void main(String[] args) { 13. B obj = new B(); 14. obj.
- Author
- Venkatesh Venkatesh
- Language
- EN