Programming-in-JAVA

This repo holds all the Java practical programs

View the Project on GitHub

JAVA-Practicals

B.Sc. (Hons.) Computer Science

1st year - C++ Projects (As per the syllabus)

Practical List

  1. To find the sum of any number of integers entered as command line arguments
  2. To find the factorial of a given number
  3. To learn use of single dimensional array by defining the array dynamically.
  4. To learn use of in case of a two dimensional array
  5. To convert a decimal to binary number
  6. To check if a number is prime or not, by taking the number as input from the keyboard
  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
  8. Write a program that show working of different functions of String and StringBufferclasss like setCharAt(, setLength(), append(), insert(), concat()and equals().
  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
  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.
  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)
  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
  13. Write a program to show the use of static functions and to pass variable length arguments in a function.
  14. Write a program to demonstrate the concept of boxing and unboxing.
  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).
  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.
  17. Write a program that creates illustrates different levels of protection in classes/subclasses belonging to same package or different packages
  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.
  19. Write a program to show the use of nested try statements that emphasizes the sequence of checking for catch handler statements.
  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).
  21. Write a program to demonstrate priorities among multiple threads.
  22. Write a program to demonstrate multithread communication by implementing synchronization among threads (Hint: you can implement a simple producer and consumer problem).
  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.
  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.
  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.
  26. Write a program to get the URL/location of code (i.e. java code) and document(i.e. html file).
  27. Write a program to demonstrate different mouse handling events like mouseClicked(), mouseEntered(), mouseExited(), mousePressed, mouseReleased() and mouseDragged().
  28. Write a program to demonstrate different keyboard handling events.
  29. Write a program to generate a window without an applet window using main() function.