Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Interface;
- interface A {
- public void display();
- default void display2(){
- System.out.println("Default access specifier");
- }
- }
- interface C extends A{
- public int square(int a);
- }
- class B implements A {
- @Override
- public void display(){
- System.out.println("Display method");
- }
- public int square(int a){
- return a*a;
- }
- }
- public class MainClass {
- public static void main(String[] args) {
- B b = new B();
- b.display();
- b.display2();
- System.out.println(b.square(6));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement