"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
How many bits is a 64 bit byte?
What is garbage collector?
Which language is java?
give an example for encapsulation?
Difference between string, stringbuffer and stringbuilder?
Can you change array size in java?
Can size_t be negative?
Which method cannot be overridden in java?
What is a double?
How the interruptible method gets implemented?
What is the purpose of using the java bean?
What is hash in java?
What does three dots mean in java?
How do you find the maximum number from an array without comparing and sorting?
what is meant by Garbage collection?