You are on page 1of 2

JAVA Practical Questions

Q1. Write a Java Program to create shape class. Derive circle and square classes
from shape class. Define appropriate constructors for all the classes. Define a
method Area( ) to find the area of the specific shape in shape class. Override
Area( ) method in circle and square classes. Assume PI = 3.14 and declare it as a
final variable in circle class.

Q2. Write a Java program to find the average marks obtained by five students in a
class, in subjects Math, English and Science. You need to define proper
constructor for the class you create to solve this problem. Also there should be a
data member to keep students roll number.

Q3. Write a Java program to create an Employee class to manage employees


information such as, employee name, id, date of birth, designation and basic
salary. Define proper constructor for this class. Define methods to display
employee details and Net Salary. The Net Salary is sum of basic salary + HRA + DA,
where HRA is 20% of basic salary and DA is 70% of basic salary.

Q4. Write a Java program to make simple calculator to perform +, * and /


operations. All the data members should be of integer type.

Q5. Write a Java program to Create a Faculty class and derive Assistant-Professor,
Associate-Professor and Professor Classes from it. Define proper constructor for
all the classes. Also define methods to show overloading and overriding features.

Q6. Write a Java program to create student class. Define proper constructor to
initialize student class object. Define methods to get details of any student (the
details may include student name, address, program of study, age). You need to
take care of exceptions handling in this program.

Q7. Write a Java program to create a simple calculator. This calculator should
perform +, —, *, /.

Q8. Write a Java program to create a Matrix class. Define a constructor to create a
3 x 3 matrix object. Also define a method to find the maximum element in a given
matrix and display its position in the matrix. Note : position of an element means
its location in terms of row and column.

Q9. Write a Java program to create ACCOUNT Class and define constructor(s) and
methods for it. Derive Saving-ACCOUNT Class from ACCOUNT Class and override
constructor of ACCOUNT Class. Make necessary assumptions wherever required.

Q10. Write a Java program which create a class named Account and derive Saving
- Account and Fixed - Account classes from it. Define appropriate constructors and
methods to access account detail.

You might also like