0% found this document useful (0 votes)
37 views3 pages

Java Practical Question BSC IT 5

no

Uploaded by

herozerothe852
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views3 pages

Java Practical Question BSC IT 5

no

Uploaded by

herozerothe852
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Java Lab Practical Questions:

1. Write a simple Java program that prints "Hello, World!" to the console.

2. Write a Java program that takes two integers as input and performs the following
operations: addition, subtraction, multiplication, and division. Display the results

3. Write a program that declares variables of different data types (int, double, char,
String) and initializes them with appropriate values. Print each variable's value.

4. Define a class Rectangle with properties length and width. Include methods to
calculate the area and perimeter of the rectangle. Create an object of the class and
display the results.

5. Write a Java Program to swap two numbers with the help of a third variable.

6. Write a Java Program to swap two numbers without a third variable.

7. Write a Java Program to enter the number from the user and check whether it is
palindrome or not.

8. Write a Java Program to print all the prime numbers between 1 to 20 with the help of
loops.

9. Write a program to print Fibonacci Series in Java.

10. Write a Java Program to enter the number from the user and check whether the
number is Armstrong or not.

11. Write a Java Program to enter the number form user and Print Factorial of a number
with the use of loop .

12. Write a Java Program of Single Level Inheritance.

13. Write a Java Program of Multilevel Inheritance.

14. Write a Java Program to achieve Multiple Inheritance using Interface.

15. Write a Java Program of Method Overloading.

16. Write a Java Program of Method Overriding.

17. Write a Java Program to achieve Abstraction using Abstract class.

18. Write a Java Program to achieve Abstraction using Interface.


19. Write a Java Program to Implement a simple multithreaded program where one
thread prints numbers from 1 to 10, and another thread prints letters from 'A' to 'J'
concurrently.

20. Create a simple Java applet that displays "Welcome to Java Applet!" on the applet
window. Make sure to include the necessary methods for initializing and painting the
applet.

21. Write a Java Program to create an array of ten elements by taking input from the
user and print it.

22. Write a Java Program to find the maximum element in the array.

23. Write a Java Program to calculate the sum of all the elements in the array.

24. Write a Java Program to reverse an Array.

25. Write a Java Program to merge two arrays and print it.

26. Write a Java Program to find the second largest element in the array.

27. Write a Java program that takes a string input from the user and reverses it without
using reverse function.

28. Create a simple applet that displays "Hello from Applet!".

29. Write a Java Program to count the total number of characters in a string.

30. Write a Java Program to use Basic String Operations using different predefined string
functions.

31. Write a Java Program to Compare Strings using equals, equalsIgnoreCase, and
compareTo.

32. Write a Java program to count the number of characters in a String.

33. Write a Java Program to check whether a String is a Palindrome or not.

34. Write a Java Program to count the number of Words in a String.

35. Write a Java Program to check whether the String is Anagram or not.

36. Write a Java Program to sort a String in ascending order.

37. Write a Java Program to print all the duplicate characters in a string.
38. Write a Java Program to create a simple GUI application using Java swing.

39. Write a Java Program to create a simple Servlet that responds to HTTP requests.

40. Write a Java program to establish a connection to a MySQL database using JDBC
and create , read, update and delete data from the database.

You might also like