postheadericon GTU MCA JAVA Practical

GUJARAT TECHNOLOGICAL UNIVERSITY (GTU)
MASTERS IN COMPUTER APPLICATION (MCA)
Year – 2 ( MCA Semester – 3) (W.E.F. JULY 2018)

Programming in JAVA (4639302 )

Practical List

1 Write a simple “Hello World” java program, compilation, debugging, executing using java compiler and interpreter.

2 Write a program to pass Starting and Ending limit and print all prime numbers and Fibonacci numbers between this range.



3 Write a java program to check palindrome number.
Input: 329 Output: not palindrome number
Input: 12321 Output: palindrome number

4 Write a java program to print factorial of a number.
Input: 5 Output: 120
Input: 6 Output: 720

5 Write a java program to check Armstrong number.
Input: 153 Output: Armstrong number
Input: 22 Output: not Armstrong number

6 Write a program in Java to find maximum of three numbers using conditional operator

7 Write a java program which should display maximum and minimum number of given 3 numbers.

8 Write a program in Java to multiply two matrix

9 Write a java program to create a class “Matrix” that would contain integer values having varied numbers of columns for each row. Print row-wise sum of the integer values for each row.

10 Write a Java application which takes several command line arguments, which are supposed to be names of students and prints output as given below:
(Suppose we enter 3 names then output should be as follows)..
Number of arguments = 3
1.: First Student Name is = Tom
2.: Second Student Name is = Dick
3.: Third Student Name is = Harry
Hint: An array may be used for converting from numeric values from 1 to 20 into String

11 Write a Java application to count and display frequency of letters and digits from the String
given by user as command-line argument.

12 Create a class “Student” that would contain enrollmentNo, name, and gender as data members. Create appropriate getter and setter methods for the “Student” class and constructors to initialize the data members. Also demonstrate constructor chaining.

13 Write a program in Java to demonstrate use of this keyword. Check whether this can access the private members of the class or not. [Refer class student in Q12 to perform the task]

14 Create a class “Rectangle” that would contain length and width as data members.
Define constructors [constructor overloading (default, parameterized and copy)] to initialize the data members. Define the member functions to find area and to display the number of objects created.
[Note: define initializer block, static initializer block and the static data member and member function. Also demonstrate the sequence of execution of initializer block and static initializer block]

15 Write a java program static block which will be executed before main ( ) method in a class.

16 Write programs in Java to use Wrapper class of each primitive data types

17 Write a class “circle” with radius as data member and count the number of instances created using default constructor only. [Constructor Chaining]

18 Create a class Vehicle with data member vehicle_type. Inherit the class in a class called car with data member model_type, company name etc. display the information of the vehicle by defining the display function in both super and sub class [ Method Overriding]

19 Create a class “Account” containing accountNo, and balance as data members.
Derive the Account class into two classes named “Savings” and “Current”. The “Savings” class should contain a data member named interestRate, and the “Current” class should contain a data member called overdraftLimit. Create appropriate member functions for all the classes to enable functionalities to check balance, deposit, and withdraw amount in Savings and Current account.
[Ensure that the Account class cannot be instantiated.]

20 Write a program in Java in which a subclass constructor invokes the constructor of the super class and instantiate the values. [ refer class Account and sub classes savingAccount and CurrentAccount in Q 19 for this task]

21 Write a program in Java to demonstrate the use of 'final' keyword in the field declaration. How it is accessed using the objects.

22 Write a java program to illustrates how to access a hidden variable. Class A declares a static variable x. The class B extends A and declares an instance variable x. display ( ) method in B displays both of these variables.

23 Describe abstract class called Shape which has three subclasses say Triangle,Rectangle, and Circle. Define one method area () in the abstract class and override this area () in these three subclasses to calculate for specific object i.e. area () of Triangle subclass should calculate area of triangle etc. Same for Rectangle and Circle

24 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.

25 Assume that there are two packages, student and exam. A student package contains Student class
and the exam package contains Result class. Write a program that generates mark sheet for students.

26 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 class display method for both these objects.

27 Write a java program to implement lambda expression with functional interface in java

28 Write a java program to accept string check whether it is in Upper or Lower case. As per case change it in according vise versa.

29 Write a java program to use important methods of String class.

30 Write a program in Java to demonstrate use of final class.

31 Write a program in Java to develop user defined exception for 'Divide by Zero' error

32 Write a program in Java to demonstrate throw, throws, finally, multiple try block and multiple catch exception.

33 Write a small application in Java to develop Banking Application in which user deposits the amount Rs 1000.00 and then start withdrawing of Rs 400.00, Rs 300.00 and it throws exception "Not Sufficient Fund" when user withdraws Rs. 500 thereafter.

34 Write a program to write at least 10 objects of the Circle class in a File using ObjectOutputStream and perform basic operations: adding, retrieving, updating, removing elements.
[ Use Generic Data types and Collections for the this task]

35 Write a program for Java Generics and Collections Sorting operations:
1. Sorting a list according to natural ordering of elements
2. Reversing sort order
3. Sorting a list whose elements of a custom type
4. Sorting a list using a Comparator

36 Write a program in Java to create, write, modify, read operations on a Text file.

37 Write a java program to illustrates use of standard input stream to read the user input.

38 Write a java program to checks the existence of a specified file.

39 Write a java program to create a file to the specified location.

40 Write a java program to demonstrate the way contents are read from a file.

41 Write a java program to first checks the existence of the specified file. If the file exists, the data is written to the file through the object of the FileOutputStream class.

42 Write a java program to count the availability of text lines in the particular file. A file is read before counting lines of a particular file.

43 Write a generic method to count the number of elements in a collection that have a specific property (for example, odd integers, prime numbers, palindromes).

44 Write a generic method to exchange the positions of two different elements in an array.

45 Write a generic method to find the maximal element in the range [begin, end) of a list.

46 Write a program to implement JDBC/ODBC connectivity to data base using java program.

47 Write a java program to connect any of database e.g. MYSQL / Oracle /MS Access/ etc.

48 Write a java program to create Employee table(Empno., Name, Designation, Salary) and insert a record in it.

49 Write a JAVA program to accept the details of student (Rno , SName , Per) from the user and insert it into the table. (use PreparedStatement Class).

50 Write a Menu driven program in Java for the following.
1. Create a Library Table (BookID, ISSNNo., Author, BookTitle, Price, Publisher, Year) .
2. Insert Record into the Library Table. 
3. Update The Existing Record. 
4. Display all the Records from the Table. 
5. Display names of books stating with “J” character 
6. Delete the record 7. Exit from the program.

Desirable : Thread Programming

1 Write a program to implement the concept of threading by extending Thread Class

2 Write a program to implement the concept of threading by implementing Runnable Interface

3 Write a program that executes two threads. One thread displays “Thread1” every 2,000 milliseconds, and the other displays “Thread2” every 4,000 milliseconds.

4 Write a program that executes two threads. One thread will print the even numbers and another thread will print odd numbers from 1 to 50.

5 Write java program that create and runs following threads:
i) print "A" 20 times
ii) print "B" 30 times
iii) print "C" 15 times

6 Write a program in Java to demonstrate use of synchronization of threads when multiple threads are trying to update common variable

0 comments:

Follow by Email

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.