"we cannot create an object of interface but we can create
a variable of it".diacuss the statement with the help of
an example.
Answer Posted / ami singh
yes we can create a variable in inerface
and i will be constant
mans to say that hey will be static and final
inerface Xyz
{
public static final i = 12;
public static final j = 20;
}
class Amit implements Xyz
{
psvm(String [] args)
{
Xyz k = new Amit();
System.out.println("value of var1 " + k.i);
Sysem.out.prinln("value ofd var 2 " + k.j);
}
}
Thanks ami singh
(amitsing2008@gmail.com)
| Is This Answer Correct ? | 11 Yes | 0 No |
Post New Answer View All Answers
What is the vector class in java programming?
What do you mean by multithreaded program?
Why can't you declare a class as protected?
What is the difference between synchronized and synchronized block?
What is definition and declaration?
What are some examples of variable costs?
What does provide mean construction?
What is the base class for error and exception?
How to create a fecelet view?
What makes a function well defined?
Does java support multiple inheritances?
Can you extend main method in java?
What is null in java?
Can a constructor be protected?
Is arraylist zero based?