Sie sind auf Seite 1von 6

Object Oriented Programming with Java List of Experiments Module 1: Introduction to Java 1.

(Welcome to Java) Write a simple Java application that displays "Welcome to Java Programming" on console (monitor). 2. (Operator & Variable) Write a Java application that calculates the average in term of Km/L given by the car. Input the distance in term of meters and fuel in term of liter. 3.. Write a Java application which calculates square root of given number. (Hint: Make use of built-in string function included in Math library.) 4. (If-else-if ladder, Switch) Write a Java program which accepts current month (int) and displays the current season [winter, summer, and monsoon] according to the value of month. 5. (Swith-case) Write a Java Application to help tourist of a city. The application should take a character m(Mumbai), k (Kolkata), c (Chennai) or d (Delhi). Accordingly, it should display more information on the city selected. 6. Write a Java application which reads command line arguments and display total number of argument and the arguments on console. 7. (Control flow) Write a Java application that reads marks for the N students for 5 subjects and display the percentage for each student. Application should able to check entered marks are valid or not. If marks are invalid it will take valid marks. 8. Write a Java application which reads (various types of) numbers from keyboard and display the same on console. 9. Write a program to generate harmonic series. 1+ 1/2 + 1/3 + 1/4 + . + 1/n

10. Write a program to generate Fibonacci series. 11. Write a program to convert temperature from centigrade to Fahrenheit and vice-versa. 13. Initialize two arrays (first having weight (Kg) and second having height (Ft) for 10 persons.) Find total number of persons having weight more than 70 and height more than 6.5. 14. (Recursion) Write a Java application that solves the tower of Hanoi problem using recursion. 15. (1-D Array) Write a Java program to sort given number in ascending order using selection sort. 16. Write Java program to Generate a Multiplication Table. (using 2-D Array) 17. Write Java program to perform Matrix Multiplication using 2-D Array. Module 2: Objects and Classes 18. (String) Write a Java application which read a text and count all occurrences of a particular word. 19. (Class & passing an object as function argument) Write a Java application tocreate a class time having hour, minute and second as data members and gettime(), showtime() and addtime() as method. Also define the necessary constructors. Create two objects of time and add them and display the result. 20. (Rectangle Class) Create a class Rectangle. The class has attributes length and width, each of which default to 1. It has methods that calculate the perimeter and the area of the rectangle. It has set andget methods for both length and width. The set methods should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle. (Makeuse of necessary

constructors and member functions) 21. Create a class Room having two data members, length & width. Now write another class RoomArea that creates an instance of this class and displays area of a room. (Make use of necessary constructors and member functions) Module 3: Inheritance and Polymorphism 22. (Single Inheritance) Create a class Room having length and width as data members and method Area to display area of a room. Derive a class BedRoom from Room having one extra data member height and method Volume to display volume of a room. (Include necessary constructor and member function to initialize and display the output.) (Make use of super keyword). 23. (Abstract class) Create an abstract class "shape" having two data members, constructors and abstract method disparea(). Derive a class "rectangle" and "traingle" from "shape" class which include appropriate constructors and implement disparea() methods. Create objects of "rectangle" and "triangle" classes and call the disparea() methods. 24. (Polymorphism with interface) Create on interface IShape which contains one shared variable PI and one method declaration area( ) to calculate the area of a shape. Define class Rectangle, Triangle, Circle and Cylinder with implementation of IShape interface. Required all constructors and get/set methods for instance variables are necessary in every class. Create a one testShape class to create an object of every shape class, read the required values and then print the area of shape. Every class must be in a separate package. 25. (Method Overriding) Create a class Figure having one method area(). Create one more class Rectangle which will override area() method of rectangle class. Demonstrate with example.

26. Write a Java Program to define a class, define instance methods and overload them and use them for dynamic method invocation. 27. Write a Java program to implement the concept of importing classes from user defined package and creating your own packages. 28. Write a Java program to demonstrate (a) use of implementing interfaces(b) use of extending interfaces. 29. Write a Java Program to implement multiple inheritance by applying various access controls to its data members and methods. Module 4: Event and GUI programming 30. Write a program using Applet (a)to display a message in the Applet (b)for configuring Applets by passing parameters. 31. (Applet) Create a Java Applet program to draw different graphical objects. 32. (Event Handling)Write a Java Application to create a frame and display a solid square at the mouse pointer when the mouse clicked. 33. (Event Handling & GUI)Write a Java Application to enter a two number in two text fields and display the sum in the third text field when you pressed the Add button. 34. (Event Handling & GUI) Create an application with a Text Field, a Text Area and button show. User has to enter the name of the file in the Text Field. When the button show is pressed, the contents of the file should be displayed in the Text Area. 35. (Event Handling & GUI) Create a Java Applet program to read two numbers using to Two different Text Field object. Users select an operation Addition,Subtraction, Multiplication or Division from List of

Radio buttons. When user press on calculate button, calculated result display in Label. Enhance your program to user select an operation and instantly calculated result display without click on button. 36. Write Java applets to implement following GUI components (a) Buttons (b) Check Boxes (c) Radio Buttons (d) Labels (e) Text Fields (f) Text Areas (g) Combo Boxes (h) Lists (i) Scroll Bars (j) Sliders (k) Windows (l) Menus (m) Dialog Box Module 5: I/O programming 37. (File Handling)Write a Java program that read a file character by character and write the contents to another file. Also display the contents on console. 38. (File Handling)Write a Java program to generate a file FILE3 which is a merger of two files FILE1 and FILE2. 39. (File Handling) Implement DOSs find command. (Syntax: find search string FILENAME). Module 6: Multithreading 40. (Exception Handling) Write a Java application that reads N integer from keyboard and display the average of N integer. Application should generate an exception if data is not in integer format. If number is not between 0 and 100 then Application should generate a Customize Exception with proper message. After Exception generated by application, program continue to read the next number. Do not count the exception iteration. Also check the printStackTrace method of exception. 41. Write a program to implement the concept of Exception Handling (a. using predefined exception (b. by creating user defined exceptions. 42. (Multi Threading)Write a Java program to generate a three different thread using Main thread. All child thread generates separately random

number for five times and adds each number to one common value summation. Maintain synchronization between thread when they goes to add number in common summation number. [Make use of start(), stop(), sleep(), suspend(), resume(), yield(), wait(), notify()] 43. Write a Java application to demonstrate thread priority. 44. Write a Java application to demonstrate exception in threads. 45. Write a Java application to demonstrate synchronization in thread. 46. Write a Java application to demonstrate Runnable interface in thread.

Das könnte Ihnen auch gefallen