You are on page 1of 4

Java lab

Master of Computer Applications
Union Christian College, ALUVA
(Affiliated to M.G University & Approved by AICTE)

MCA307 P - OOPS THROUGH JAVA PRACTICALS


(2019 – 2020)
Java lab

Third semester Regular Batch(3R_2018 & 2019 admn)

Java Lab Cycle 1

1. Write a program to create a menu with the choices – factorial of a


number , check palindrome or not , Armstrong numbers in a given range
, number traingle by entering the limit, fibonacci series.

2. Write a program to create a menu with the choices – matrix addition ,


matrix multiplication,trace of matrix(the sum of the elements on the main
diagonal) and symmetric or not

3. Write a program to sort the elements of an array by entering values from


the key-board and also find out the largest and smallest element from a
two dimensional array
4. Find the factorial of a number using recursion.
5. Implement string handling functions (String class and StringBuffer class)
6. Implement static blocks and static methods.
7. Implement the use of
a) nested class
b)nested methods
8. Implement the use of Varargs method.
9. Create a class Bank-Account with member variables-AcctNo, CustomerName ,
account type, Balance and methods getDetails, deposit, withdraw, displayDetails
, without using constructors. Every account must ensure a minimum balance.
Get the details of n customers, perform the bank transactions and display the
details in tabular form.
10. Implement the above program using constructors.
11. Implement the polymorphism concept : Overload the method volume that
returns volume of different shapes. The method is to be overloaded with one
parameter,2 parameters and 3 parameters and the parameters must accept
fractional values. Calculate the volume of at least 3 different shapes.

12. Implement the use of this, return and final


13.Implement single, multi level and heirarchical inheritance.
14.Create a class Cake with attributes flavor and rate. Inherit a class
’orderCake’ with additional attributes weight and pricecalc() and another
class ‘readymade cake’ with additional attributes quantity and pricecalc().
Implement the above program and display the details in tabular form.
15.Create a class called Employee so that it contains member variables:
name (String), email (String), and gender (char of either 'm' or 'f')· A
Java lab

constructor to initialize the name, email and gender with the given
values.Define get and set methods- setEmail(), getName(), getEmail(), and
getGender().
(There are no setters for name and gender, as these properties are not
designed to be changed).Define another method toString() method that
returns "name (gender) at email", e.g., "John(m) at john@gmail.com".
Implement the concept of encapsulation.
16. Create a class name Toys with two place holders area () and perimeter ().
By using the properties of the Toys class calculate the area and perimeter of
bus, ball and 3 sided toy.
17. Implement Dynamic method dispatch to calculate the volume of at least 3
different shapes.
18. Find the number of characters in each string that is passed as command line
argument and also find the total number of vowels in it.
19. Define one class that contains placeholders for getting the personal details
of employees(Name, DOB, Address,Blood Group etc). Create two interfaces that
contain methods for accepting professional details(Designation, date of
joining,salary etc) and loan details(Loan type , loan A/C no,sanction date,
sanction amount etc) . Implement multiple inheritance and display all details
of n employees.
20. Create a package student which contains personal and educational details .
Import
this package and print the details of n students in tabular form.

21. Write a Java program to implement the following exceptions


a) Arithmetic Exception
b) ArrayIndexOutOfBounds Exception
c) NullPointer Exception
d) NumberFormat Exception
e) StringIndexOutOfBound Exception
22. Create an user defined exception
A) To check whether the number is positive or negative
B) To add 2 numbers and if the result is less than 20 , raise an exception

23.Create multiple threads and use all possible methods associated with Threads.

(isAlive(),yield(),start(),sleep(),stop()).

24. Illustrate the use of synchronized keyword.


Java lab

25. Perform some file operations and also perform read the content of a file and
write

it to another file. After writing , insert some more contents to the file and
copy

to another file.

26. Wrtie a Java program to perform


A) Byte Stream classes
B) Character Stream Classes
C) I/O classes

You might also like