can you create interface instance ?
Answer Posted / shanmukha
Hi,
We can't create instance for an interface or abstract
class.Just remove the following code from the program
written by Uday.
interface Test
{
public void wish();
}
Remove the above code and run the program,then program will
compile and execute properly,because he used anonymous class.
| Is This Answer Correct ? | 11 Yes | 2 No |
Post New Answer View All Answers
Under what conditions is an object’s finalize() method invoked by the garbage collector?
What is visibility mode?
What are parsing rules?
What are the different types of java?
Which is better stringbuffer or stringbuilder?
Why is string class considered immutable?
How large is a boolean?
Can a class be declared as protected?
How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?
What is sorting in java?
What is static data type in java?
What is the main use of generics in java?
What does localhost mean?
1.IN CASE OF DYNAMIC METHOD DISPATCH WHY WE USE REFERENCE VARIABLE,WE CAN USE THE DIFFERENT DEFINED OBJECT DIRECTLY TO ACCESS THE DATA MEMBER AND MEMBER FUNCTION OF THAT RESPECTIVE CLASS?WHAT IS THE MAIN FUNCTION OF "REFERENCE VARIABLE" HERE?
In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?