"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
Why java is call by value?
Give me example of derived data types.
How do you do descending order in java?
What do you mean by an interface in java?
What is meant by design patterns?
What are void methods?
Does isempty check for null?
what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread
What do you understand by synchronization?
How many bits is a boolean?
What is comparator in java?
What is use of super keyword?
How can you add and remove nodes in jtree?
Is java a virus?
What does the append?