Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Default Interface Inheritance : create class that implements the interface

    I'm just preparing for my exam. Help me solve this problem.


    Java Code:
    interface J {
        int j = 200;
        int j1();
    }
    interface K {
        double k1();
    }
    interface L extends J,K{
        boolean l1();
    }
    class I implements L{
        public boolean l1() {
            return true;
        }
        public int j1() {
            return 4;
        }
        public double k1() {
            return 6.8;
        }
    }
    class InterfaceInheritance{
        public static void main(String[] g){
            I i=new I();
            System.out.println(i.j);
            System.out.println(i.j1());
            System.out.println(i.k1());
            System.out.println(i.l1());
        }
    }

    Result :
    200
    4
    6.8
    true

    I just want to learn how to create o class that implements the interface j and k. Then, call the method on a main program in class InterfaceInheritance.

    thanks guys for helping me prepare for the exam

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

Similar Threads

  1. What about variables? implements Interface > extends
    By Bigfatcat in forum New To Java
    Replies: 8
    Last Post: 01-08-2012, 08:57 AM
  2. Extends a class that implements an interface
    By monocole in forum New To Java
    Replies: 2
    Last Post: 12-27-2011, 03:55 AM
  3. Replies: 0
    Last Post: 10-31-2011, 11:55 AM
  4. Interface and implements
    By Bored2 in forum New To Java
    Replies: 27
    Last Post: 11-10-2010, 01:08 PM
  5. Interface Inheritance
    By McChill in forum New To Java
    Replies: 2
    Last Post: 03-04-2009, 02:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •