Assignment-4
Assignment-4
Assignmen-4
1. Explain methods of String class and StringBuffer class.
2. Define package. Describe steps to create package and access package with example.
Also explain the importance of static import in java.
3. Explain java support multiple inheritance with example.
4. Define a class A in package apack. In class A, three variables are defined of access
modifiers protected, private and public. Define class B in package bpack which extends
A and write display() method which accesses variables of class A. Define class C in
package cpack which has one method display() in that create one object of class A and
display its variables. Define class ProtectedDemo in package dpack in which write main
() method. Create objects of class B and C and display method for both these objects.
5. Write a java program to implement an interface called Exam with a method Pass (int
mark) that returns a boolean. Write another interface called Classify with a method
Division (int average) which returns a String. Write a class called Result which
implements both Exam and Classify. The Pass method should return true if the mark is
greater than or equal to 50 else false. The Division method must return “First” when
the parameter average is 60 or more, “Second” when average is 50 or more but below
60, “No division” when average is less than 50.
6. Differentiate between:
1. throw v/s throws
2. abstract class v/s interface
3. String v/s StringBuffer
4. Checked Exception v/s Unchecked Exception
7. Draw Exception class hierarchy.
8. Explain keywords: try, catch, finally, throw, throws
9. Explain Exception Handling mechanism by giving a suitable example.
10.Create and throw user define exception.
11.Write a program to illustrate the use of command line arguments. Also implement
necessary exception handling.
12.Explain wrapper class with example. Explain autoboxing and unboxing with example.
13.Draw and Explain Collection framework hierarchy.
14.Describe methods of Collection Interface.
15.Explain ArrayList and its methods and iterator with example.
16.Discuss the Set and List interfaces of Collection Framework with example.