can you create interface instance ?
Answer Posted / saroj singh
we can create instance of Interface like..
interface Imployee
{
void Pay();
void Salary();
}
class SeniorSoftEngg : Imployee
{
public void Pay()
{
Console.WriteLine("Inside Pay");
}
public void Salary()
{
Console.WriteLine("Inside Pay");
}
}
class Program
{
static void Main(string[] args)
{
Imployee Emp = new SeniorSoftEngg();
Emp.Pay();
Emp.Salary();
}
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What are the types of collections in java?
why Interface used?
Is array serializable java?
What is meant by structural programming?
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.
Is array passed by reference in java?
What happens when a thread cannot acquire a lock on an object in java programming?
Explain with example the concept of constant variable in java.
Do I need java for windows 10?
Can we execute a program without main() method?
Why we use set in java?
State the merge-sort principle and its time complexity.
Why is core java important?
When super keyword is used?
Can a main method be declared final?