Posted in All Posts, Semester 4

Sem 4 – CJ Unit 4 Programs

CJ – Core Java

Unit 4 – Packages, Multithreading, Applets and Graphics

1. Write a program to calculate the area by using an interface.
Download

2. Write a program to show use of the import statement.
Download (Main file – cj4_2.java) || Download (Package file – Calculator.java)


3. Write an interface called Numbers, with a method int Process(int x, int y). Write a class called Sum, in which the method Process finds the sum of two numbers and returns an int value. Write another class called Average, in which the Process method finds the average of the two numbers and returns an int.
Download

4. Write a java program to create 3 threads using Thread class. Three threads should calculate the sum of 1 to 5, 6 to 10 and 11 to 15 respectively. After all thread finishes main thread should print the sum and average.
Download

5. Write a java program that accepts marks of 5 subjects from display the average. If any value is not between 0 and 100 then throw custom exception RangeException and handle it.
Download

6. Write a java program to create 3 threads using Runnable interface. One thread should display “Thread 1” at every 1000 Milliseconds and other should display “Thread 2” at every 3000 milliseconds. Third thread should calculate the sum of 1 to 5, 6 to 10 and 11 to 15 respectively. After all thread finishes main thread should print the sum and average.
Download

7. Write a Java applet that draws a circle centered in the center of the applet and filled with random color. Radius of the circle should be passed as a parameter.
Download

8. Write an applet that take three numbers as parameters and displays their sum and average.
Download

9. Write a java program that creates two threads using Runnable interface. One thread should display “Thread 1” at every 500 Milliseconds and other should display “Thread 2” at every 700 milliseconds.
Download

10. Write a Java applet that draws a circle divided in 6 equal parts.
Download

Download All Programs

I hope that you found this article to be helpful.
Please share your thoughts in the Comments Section.

Please like our Facebook page to show your support.

Suggested Reading

Comment your thoughts