Java Assignment1
Java Assignment1
Unit 1
4. Write the java to implement Simple Calculator to perform addition, multiplication and
finding the large number. Write the overloaded methods to implement the following
methods.
a. Addition(2 and 3 numbers)
b. Multiplication(2 and 3 numbers)
c. Large(2 and 3 numbers).
5. Write the java code to demonstrate the usage of static variable.
Unit 2
1. Explain the concept of inheritance. Write about the types of inheritance.
2. Write the java program using the following instructions which demonstrates the usage of
constructors
a. Write the class name Box which have 3 attributes-length, width and height.
b. One method called calVolume() to calculate the volume of given box.
c. 4 constructors which take
i. 0 parameters
ii. 1 parameter
iii. 2 parameters
iv. 3 parameters
d. Write second class called BoxDemo which contains main method. In the main
method create, default box, cube, cuboids.
3. Write the java code to demonstrate the usage of super() and this() constructor calls in
the inherited classes.