Ex - No:1 Java Package With Simple Stack and Queue Class Aim: Algorithm: Stack Class
Ex - No:1 Java Package With Simple Stack and Queue Class Aim: Algorithm: Stack Class
Ex - No:1 Java Package With Simple Stack and Queue Class Aim: Algorithm: Stack Class
3. Declare the variables month, day, year as private and create constructor with arguments.
4. Check the condition for exception. If the date is valid, It will proceed the program otherwise
display the exception Invalid.
5. Use Boolean type for method to return the values as either true or false.
6. Check the values for month and values for day using if loops.
10. In main() create object today and give current date as value for constructor fields
3. Create a constructor with arguments and declare variables dim1, dim2 and PI.
5. Create the classes Rectangle, Triangle, Circle, and Ellipse to find the area.
6. Define abstract method area() inside the subclasses and call the constructor of class Shape using
super keyword.
7. In main(), create the objects for all classes and pass values to fields of constructors.
9. Using reference variable of class Shape, call the method area() of all subclasses
5. Create an instance for draw test class and call the init(0 and start() methods in the main method.
5. Set the frame layout for the applet and set the background color to gray using setBackground()
method .
8. Set all the Numbered JButtons to blue .the rest to red usig setForeGround() method.
11. Declare the main function and create the instance for calculator and set the attributes
setTitle(),setSize(),setResizable().
2. Declare the main function within the class Linked list demo.
3. Insert items in to the list using add() method use addLast() to insert at the end.
6. Use remove() first(0,removeLast() to delete the element at the first and at the last.
5. In the run() method of producer thread put the messages on the queue using putmessages() and
suspend the thread for one sec using sleep(1000).
6. Declare the getmessage() method and ceck whether there is any message if no wait for one.
7. After receiving the message remove the message and return it.
8. Create a constructor to assign values to them.
9. In the run method of consumer class call the getmessage() method of producer thread and print the
message.
11. Create two instances with different name for consumer thread.
7. Declare a class Multithreaded programming and create two list using ArrayList.
8. Create instances for pipedreader and pipedwriter prl and pwl respectively.
9. Get the Fibonacci series from the stream pr2 and store them in lsit2 by using retainAll() method and
print them.
Result:
Thus the program was compiled and executed successfully.
Ex.No:12 MULTITHREADED GUI APPLICATION
AIM:
To develop a multithreaded GUI application in java.
ALGORITHM:
1. Create the class ball which implements a ball which moves and bounces of the edges of a rectangle.
2. Using the move() method move the ball to the nect postion by reversing the direction if it bits one
of the edges.
9. Add a bouncing ball to the canvas and starts a thread to make it bounce.