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.


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More Core Java Interview Questions

What does this mean java?

0 Answers  


What is a default method?

0 Answers  


Give a practical example of singleton class usage?

0 Answers  


What is independent and dependent variables in research?

0 Answers  


Explain implementation and how is it different from conversion?

0 Answers   Aricent,


What state does a thread enter when it terminates its processing in java programming?

0 Answers  


What are design patterns and please explain?

0 Answers  


Is int a class in java?

0 Answers  


What do you mean by Function Overloading in java?

0 Answers   Impetus,


what is main purpose of abstract class?

7 Answers  


Given: 10. interface A { void x(); } 11. class B implements A { public void x() { } public voidy() { } } 12. class C extends B { public void x() {} } And: 20. java.util.List list = new java.util.ArrayList(); 21. list.add(new B()); 22. list.add(new C()); 23. for (A a:list) { 24. a.x(); 25. a.y();; 26. } What is the result? 1 Compilation fails because of an error in line 25. 2 The code runs with no output. 3 An exception is thrown at runtime. 4 Compilation fails because of an error in line 20.

3 Answers  


What is byte code and why is it important to java’s use for internet programming?

0 Answers  


Categories