Professional Documents
Culture Documents
om
public class Q1 extends Thred
{
public void run ()
{
t.c
System.out.println(“Before start method”);
this.stop();
}
bu
public static void main (String [] args)
{
Q1 a = new Q1 ();
yw
a.start ();
}
}
a) Compilation error at line 7
m
default:
System.out.println (“Hello”);
om
}
a) int c) object
b) double
t.c d) byte
ix) Which one of the following is a valid declaration of an applet?
a) Public class MyApplet extends java.applet.Applet {
bu
b) Public Applet MyApplet {
c) Public class MyApplet extends applet implements Runnable {
d) Abstract class MyApplet extends applet implements Runnable {
yw
om
private int a;
public A (int a1) {
a = a1;
}
t.c
public void print (int data) {
System.out.println (“Result:” + data);
}
bu
class B extends A {
yw
super (b1);
m
return data;
6. What is the basic goal of UML? What do you mean by collaboration diagram?
7. What is the base class of Error and Exception? Differentiate between Error and Esception.
om
10. a) What is multi-threading?
b) Write a program which can run a main thread and a child thread simultaneously.
c) Give a method that does not declare any exception. Can we override that method in a
subclass to throw an exception?
t.c
11. a) What are Java “thread” and “monitor” ?
bu
b) Distinguish between “dynamic binding” and “Message passing”.
c) What is “Template” and “Package” with example.
yw
12. a) What is meant by aggregation? And explain the different types of aggregation.
b) What are the differences between a sequence diagram and a collaboration diagram?
c) Draw object diagram for the following object classes, with association names attributes
and additional object classes if required.
m
Object classes: college, playground, principal, classroom, board, book, students, faculty,
cafeteria, ruler, door, swing.
d) Draw a sequence diagram for the cellular phone connection.
13. a) Describe different forms of inheritance with examples.
b) Why Java does not support multiple inheritance?
c) What is the difference between interface & abstract class? Implement Interface with a
sample code.
d) Distinguish between ‘Data Abstraction and ‘Encapsulation’.