Java Practical – Outputs of All Programs (Sample
Runs)
1. Square Root (input: 25) -> 5.0
2. Simple & Compound Interest (p=1000, r=10, t=2)
SI = 200.0
CI = 210.0
3. Average (args: 3 4 5) -> 4.0
4. Menu:
n=5, ch=1 -> Odd
n=121, ch=2 -> true
n=7, ch=3 -> true
5. Profit/Loss (cp=1000, sp=1200) -> 20.0
6. Electricity bill (units=300) -> 875.0
7. Even/Odd (input: 8) -> Even
8. Same as program 5 -> 20.0
9. Quadratic roots (1, -3, 2) -> 2.0 1.0
10. Sum & Reverse (1234) -> 10 4321
11. Prime (7) -> Prime
12. Array (5 elements: 2 9 1 7 4) -> 1 9
13. Series 1+x+...+x^n (x=10, n=10) -> 11111111111.0
14. Fibonacci upto 100 -> 1 1 2 3 5 8 13 21 34 55 89
15. String copy -> Hello
16. Cone (r=3, h=4)
Area ≈ 75.398
Volume ≈ 37.699
17. Employee -> Ram 25
Gross Salary = 21500.0
18. Volumes:
Cube(3) -> 27.0
Cylinder(2,5) -> 62.8318
Sphere(2) -> 33.5103
19. Complex add -> 3+7i
20. Points ->
2
true
21. Cube volume (3) -> 27.0
22. Swap (2,3) -> 3 2
23. Complex using this -> 2+5i
24. Voting age (20) -> Eligible
25. Shape area (Square 3) -> 9.0
26. Parent variable -> 10
27. Digital clock -> 10:20:30
28. Interfaces ->
Person
Employee
29. Book ->
Copyright
Contents
30. Result ->
1
Sports=5
31. Circle area (r=3) -> 28.26
32. Divide by zero -> Error
33. Multiple catch -> Divide
34. Invalid Age (age=-1) -> Invalid Exception
35. Marks array -> Error
36. Vote (16) -> Not eligible
37. Thread -> Thread
38. Runnable -> Run
39. Even & Odd -> 0 2 4 6 8 10 and 1 3 5 7 9
40. Synchronized table (5,10,15) -> Multiplication tables printed
41. Applet RGB -> Red rectangle drawn
42. Applet calculator (5+3) -> 8
43. Country list (India selected) -> India
44. Subjects combobox (Java) -> Java
45. File copy -> Content copied from [Link] to [Link]
46. JDBC -> 1 Ram