Java Programs List

Program 1 : To find the sum of any number of integers entered as command line arguments.

Program 2 : To find the factorial of a given number.

Program 3 : To learn use of single dimensional array by defining the array dynamically.

Program 4 : To learn use of in case of a two dimensional array.

Program 5 : To convert a decimal to binary number.

Program 6 : To check if a number is prime or not, by taking the number as input from the keyboard.

Program 7 : To find the sum of any number of integers interactively, i.e., entering every number from the keyboard, whereas the total number of integers is given as a command line argument.

Program 8 : Write a program that show working of different functions of String and StringBufferclasss like setCharAt(), setLength(), append(), insert(), concat()and equals().

Program 9 : Write a program to create a “distance” class with methods where distance is computed in terms of feet and inches, how to create objects of a class and to see the use of this pointer.

Program 10 : Modify the “distance” class by creating constructor for assigning values (feet and inches) to the distance object. Create another object and assign second object as reference variable to another object reference variable. Further create a third object which is a clone of the first object.

Program 11 : Write a program to show that during function overloading, if no matching argument is found, then java will apply automatic type conversions(from lower to higher data type).

Program 12 : Write a program to show the difference between public and private access specifiers. The program should also show that primitive data types are passed by value and objects are passed by reference and to learn use of final keyword.

Program 13 : Write a program to show the use of static functions and to pass variable length arguments in a function.

Program 14 : Write a program to demonstrate the concept of boxing and unboxing.

Program 15 : Create a multi-file program where in one file a string message is taken as input from the user and the function to display the message on the screen is given in another file (make use of Scanner package in this program).

Program 16 : Write a program to create a multilevel package and also creates a reusable class to generate Fibonacci series, where the function to generate Fibonacii series is given in a different file belonging to the same package.

Program 17 : Write a program that creates illustrates different levels of protection in classes/subclasses belonging to same package or different packages.

Program 18 : Write a program “DivideByZero” that takes two numbers a and b as input, computes a/b, and invokes Arithmetic Exception to generate a message when the denominator is zero.

Program 19 : Write a program to show the use of nested try statements that emphasizes the sequence of checking for catch handler statements.

Program 20 : Write a program to create your own exception types to handle situation specific to your application (Hint: Define a subclass of Exception which itself is a subclass of Throwable).

Program 21 : Write a program to demonstrate priorities among multiple threads.

Program 22 : Write a program to demonstrate multithread communication by implementing synchronization among threads (Hint: you can implement a simple producer and consumer problem).

Program 23 : Write a program to create URL object, create a URL Connection using the openConnection() method and then use it examine the different components of the URLand content.

Program 24 : Write a program to implement a simple datagram client and server in which a message that is typed into the server window is sent to the client side where it is displayed.

Program 25 : Write a program that creates a Banner and then creates a thread to scrolls the message in the banner from left to right across the applet’s window.

Program 26 : Write a program to get the URL/location of code (i.e. java code) and document(i.e. html file).

Program 27 : Write a program to demonstrate different mouse handling events like mouseClicked(), mouseEntered(), mouseExited(), mousePressed, mouseReleased() and mouseDragged().

Program 28 : Write a program to demonstrate different keyboard handling events.

Program 29 : Write a program to generate a window without an applet window using main() function.

Program 30 : Write a program to demonstrate the use of push buttons.