Vous êtes sur la page 1sur 6

nihar Ranjan Roy

niharranjanroy@yahoo.com

Command Line Argument


1. WAP in java to accepts two numbers (int) as command line arguments and
print their sum.
2. WAP in java to accepts two numbers (int) with the help of JOptionPane
class and display their sum.
3. WAP in java to find the sum of the digits of a number.
4. WAP in java to convert an int value into its Hexadecimal and binary
equivalent.

Functions
5. Write a non-static function in java that prints the sum of two numbers.
6. Write a static function in java to find the sum of two numbers.
7. WAP in java to print the factorial of a number using recursion.

Object/Classes/Inheritance
8. WAP in java in which class A extends Class B. what is the order of the
execution of the constructors if and object of class B is created?
9. Create an abstract class Shape which has a field PI=3.14 as final and it
has an abstract method Volume. Make two subclasses Cone and Sphere
from this class and they print their volume.
10. WAP in java in which a class inherits two interfaces.
11. WAP in java to swap two integers with out using third variable. The
swapping must be done in a different method in a different class.
[Hint: use pass be reference]
12. WAP in java that keeps track of all the objects created from a particular
class and prints the no of objects created, whenever an object is created.

Exception Handling
13. WAP in java to handle ArithmeticException.
14. WAP in java to handle the following condition using a single try block
int arr[]={3,0};
int i=arr[0]/arr[1];
catch all the possible type of exceptions from the above statement.
Page 1 of 6

nihar Ranjan Roy


niharranjanroy@yahoo.com

15. WAP in java to throw a user define Exception if the number of marks for
a student is greater than 100.

Package Handling
16. WAP in java to find the sum of two numbers using package. The class
doing the addition should be in a user defined package and the other class
should import this package to use it.

I/O Handling
17. WAP in java to print names of all the files in the current directory.
18. WAP in java to print the source code of the current file.
19. WAP in java to copy a file
Example MyCopy SourceFile DestinationFile
20. WAP in java to accept input from the user and whatever the user inputs
store it into a file.
21. WAP in java to accept the student details and store it into a file and
display it if asked by the user. There should not be any limit on the no to
records it should be decided by the user.
[Hint: use DataInputStream and DataOuputStreams]
22. Do the above program but this time the object should be directly written
and read from the file.
[Hint: use ObjectOutput and ObjectInput classes]
23. WAP in java to accept multiline input from user and print the no of
characters, lines and words entered by the user.

String/Arrays/Vectors
24. WAP in java to accept name of 10 students and print them in alphabetic
order.
25. WAP in java that accepts a string from the user and then asks for a string
which is expected to be present in the former string. Find for the
occurrence of the second string in the first.
26. WAP in java that uses StringBuffer class and at least three of its member
functions.

Page 2 of 6

nihar Ranjan Roy


niharranjanroy@yahoo.com

27. Create a Vector and perform the following operations on it


a. append
b. addElement
c. removeElement
d. addElementAt(I)

Applets
28. write an applet that prints HellWorld
29. Write an applet that prints the message showing at which state it is in its
life cycle.
30. Write an applet which changes its background color on the basis of
parameters provided to it.
31. Write an applet to display and image.
32. Write an applet that shows the contents of a text file.
33. Write an applet whose output is like this

Networking
34. Write a Client Server Chatting program in java using
a. TCP/IP
b. UDP
35. Write a file server program in which the client requests for a file and then
the file is send to the client on network and finally a copy is available on
the client machine.

Multi-Threading
36. Write a program in java which tells the following information about the
main thread
a. Thread Name
b. Priority
c. State
d. ThreadGroup
Page 3 of 6

nihar Ranjan Roy


niharranjanroy@yahoo.com

37. Create two child threads and assign some task to them. Ensure that the
child thread terminate before the main thread.
38. Write a program which uses the concepts of thread Synchronization.

Layout Managers
39. Write programs to demonstrate how the following layout managers work
a. FlowLayout
b. BorderLayout
c. GridLayout
d. GridbagLayout
e. CardLayout
f. NullLayout
40. Design a login form like this

Event Handling
41. Write a program in java in which when a button is clicked it tells how
many times it has been clicked till now.
42. In a Frame/JFrame create three buttons and display a message
informing which button is clicked
43. Add event handling to the login form as below for a successful login the
login name and pwd should be same

Page 4 of 6

nihar Ranjan Roy


niharranjanroy@yahoo.com

44. Using Checkbox ask the user what he/she would like to have today in
the lunch. Add event handling to it and finally inform the user about
his/her choice.
45. Using CheckboxGroup ask the user weather he is a CSE,IT,or ECE
student and finally display his/her choice.
46. Using list control ask the user to which country he belongs to among a
list of five countries. DO the event handling and inform him about his
choice.
47. Using list Control ask the user in which all cities , the branch office of
his company are?. Give him a list of 6 cities. Do the event handling and
inform him about his choice.
[note: the user can choose multiple cities]
48. Create menu through which the user sets the current frame background
color.
49. Use three scrollbars to choose the Red, Green and Blue components of a
color that will decide the background color of the frame.
50. User the ColorChooser to choose a color and set the background color of
the frame.
51. Use the File chooser to choose a file and display the name and location
of the chosen file.

JDBC
52. Create a student data base system in Microsoft access/ oracle and make
it accessible to the user though GUI. Through this frame the user should
be able to navigate in all possible ways through the resultset ie (first,
previous, next, last)

Page 5 of 6

nihar Ranjan Roy


niharranjanroy@yahoo.com

53. In the above program add the facility for


a. Data modification
b. Data insertion
c. Data search

Beans
54. Create a simple bean and test it in the bean box.

Servlets
55. Write a servlet program for addition of two numbers. The users enters
two numbers and the servlet displays its sum after processing.

Page 6 of 6

Vous aimerez peut-être aussi