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
How to do encapsulation in java?
what is deadlock? : Java thread
Give reasons supporting that string is immutable.
Explain parallel processing in java8?
What is the difference between a method and a procedure?
What is another word for methodology?
explain what is transient variable in java?
Explain scope or life time of local variables in java?
Is a case study a method or methodology?
what are Hostile Applets?
Is java a super set of javascript?
What is final keyword in java? Give an example.
State the difference between strings and arrays.
Is array passed by reference in java?
Draw a UML class diagram for the code fragment given below: public class StringApplet extends Applet { private Label sampleString; private Button showTheString; private ButtonHandler bHandler; private FlowLayout layout; public StringApplet() { sampleString = new Label(" "); showTheString = new Button (" Show the String"); bHandler = new ButtonHandler(); layout = new FlowLayout(); showTheString.addActionListener(bHandler); setLayout(layout); add(sampleString); add(showTheString); } class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { samplestring.setText("Good Morning"); } } } Note: The methods need not be indicated on the diagram.