Topic
3 replies Latest Post - ‏2013-11-08T04:28:40Z by ArnavKumar
SystemAdmin
SystemAdmin
1240 Posts
ACCEPTED ANSWER

Pinned topic Using Interface

‏2008-01-18T08:11:29Z |
Hi,

I have defined public static variable in the Interface. Can I access the interface variable from other class without implementing the interface.

Regards,
Raja
Updated on 2008-01-23T07:10:35Z at 2008-01-23T07:10:35Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1240 Posts
    ACCEPTED ANSWER

    Re: Using Interface

    ‏2008-01-21T23:14:28Z  in response to SystemAdmin
    simple answer: yes
  • SystemAdmin
    SystemAdmin
    1240 Posts
    ACCEPTED ANSWER

    Re: Using Interface

    ‏2008-01-23T07:10:35Z  in response to SystemAdmin
    ABSOLUTELY!!!
  • ArnavKumar
    ArnavKumar
    4 Posts
    ACCEPTED ANSWER

    Re: Using Interface

    ‏2013-11-08T04:28:40Z  in response to SystemAdmin

    Why are asking this!!!

    public interface demoInterface {

    public static String name="variable in interface";

    }

    class ImplmntIntrfce implements demoInterface{

    String name1=name;

    }

    public class UseInterface {

    public static void main(String[] args) {

    ImplmntIntrfce ifc = new ImplmntIntrfce();

    String name2=ifc.name;

    System.out.println(name2);

    }

    }

     

     

    Updated on 2013-11-08T04:29:05Z at 2013-11-08T04:29:05Z by ArnavKumar