Question :Can an interface have variables defined in it? How do you use
them? (CoreJava)
Answer :Yes we can have variables defined in an Interface. Have a look at the
class below to
know how to use those variables
public interface MyInterface
{
String STR1 = "STR1";
String STR2 = "STR2";
}
public class MyTestClass implements MyInterface
{
public static void main(String args[])
{
System.out.println(STR1);
}
}
www.interviewhelper.org is a hope for all the Job seekers. Users can find unlimited here. These range from technical to HR, from functional to behavioral. www.interviewhelper.org contains in the fields like Ajax,VB,Networking,Sharepoint,JEE,Perl,Javascript,Bioinformatics,Classic ASP,Unix,Linux,Accounting,Oracle DBA,Microprocessor,Bluetooth,jms,jme,.net framework,ABAP,ASP,ASP.net,Basic .net Framework,Interview Questions,C language,C++,database,Oracle,Java,PHP,LAMP,SAP etc.
Thursday, March 12, 2009
Can an interface have variables defined in it? How do you use
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment