Assignment III
Q1. What is Inheritance in java? Describe types of Inheritance with example.
Q2. Write a program in java. A class "Employee" contains two fields "Name' and
Designation', extends the class to class "Department" it contains 'dept_ no' and 'dept_
name', in interface, named "Company" using the above classes and interface get the
appropriate information and display it.
Q3. What is Abstract classes? Explain with example.
Q4. What is meant by Polymorphism? What is compile time and Runtime polymorphism
Q5. What Package in java? And how to create and use the package
Q6. What is Exception handling? Explain how it can be handled in java.
Q7. Create a class account that extends the Exception class having two methods deposit and
withdraw if.
i) the balance is less than required minimum amount and
ii) The withdrawn amount is more than balance than it throws the appropriate
exception message
Q8. Create three classes:
1. Vehicle – has speed and capacity.
2. Car – extends Vehicle, adds fuelType
3. ElectricCar – extends Car, adds batteryCapacity.
Write a program that creates an ElectricCar object and show all details.
Q9. What are the different Wrapper classes in java? Explain in brief.
Q10. Describe any three methods of InputStream & OutputStream classes
Q11. Write a java program that reads text from input file “[Link]” & copy the content to
another text file “[Link]”.
Q12. Explain Thread life cycle in detail.