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

Java Programs

The document lists a comprehensive set of programming exercises and concepts categorized into various sections such as Basic Programs, Loop-Based Programs, Array Programs, OOP Programs, Exception Handling, File Handling, Collections, Logic & Number-Based Programs, String-Specific Interview Programs, Recursion-Focused Programs, and Advanced topics. Each category includes numerous specific tasks and challenges that cover fundamental programming skills, data structures, algorithms, and object-oriented programming principles. This resource serves as a guide for learners to practice and enhance their coding abilities across multiple programming paradigms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Java Programs

The document lists a comprehensive set of programming exercises and concepts categorized into various sections such as Basic Programs, Loop-Based Programs, Array Programs, OOP Programs, Exception Handling, File Handling, Collections, Logic & Number-Based Programs, String-Specific Interview Programs, Recursion-Focused Programs, and Advanced topics. Each category includes numerous specific tasks and challenges that cover fundamental programming skills, data structures, algorithms, and object-oriented programming principles. This resource serves as a guide for learners to practice and enhance their coding abilities across multiple programming paradigms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1. Basic Programs 16.

Frequency of elements
1. Hello World 17. Second largest element
2. Swap two numbers 18. Second smallest element
3. Check even or odd 19. Duplicate elements
4. Find largest of two numbers 20. Sum of even & odd indexed elements
5. Find largest of three numbers 21. Pair with given sum
6. Leap year check 22. Rearrange positive and negative
7. Simple interest calculation numbers
8. Compound interest 23. Replace every element with next
9. Armstrong number check greatest
10. Palindrome number check 24. Move all zeros to end
11. Reverse a number String Programs
12. Sum of digits 1. Read and print string
13. Factorial of a number 2. Length of string
Loop-Based Programs 3. Reverse a string
1. Print even numbers till N 4. Check palindrome
2. Print odd numbers till N 5. Count vowels & consonants
3. Sum of first N natural numbers 6. Count digits and spaces
4. Multiplication table 7. Compare two strings
5. Fibonacci series 8. Concatenate two strings
6. Prime number check 9. Convert to uppercase
7. Print N prime numbers 10. Convert to lowercase
8. Count digits in a number 11. Count frequency of characters
9. Print digits of a number 12. Remove spaces from string
10. Find LCM of two numbers 13. Remove vowels from string
11. Find GCD of two numbers 14. Replace substring
12. Print pattern – half pyramid 15. Find substring
13. Print pattern – inverted pyramid 16. Word count in string
14. Print pattern – full pyramid 17. Check anagram
15. Print pattern – diamond 18. Check pangram
16. Print Pascal's triangle 19. Find longest word
17. Print Floyd's triangle 20. Sort characters
18. Armstrong number in range 21. Remove duplicates
19. Palindrome in range 22. Print each word
20. Prime numbers in range 23. Capitalize each word
Array Programs 24. Toggle case
1. Read and print array 25. Palindrome words in string
2. Sum of array elements OOP Programs
3. Average of array elements 1. Class and object example
4. Find max in array 2. Constructor overloading
5. Find min in array 3. Method overloading
6. Search element in array 4. Method overriding
7. Remove duplicate elements 5. Static variables and methods
8. Sort array ascending 6. This keyword usage
9. Sort array descending 7. Final keyword usage
10. Merge two arrays 8. Inheritance example
11. Copy one array to another 9. Multilevel inheritance
12. Reverse array 10. Hierarchical inheritance
13. Left rotate array 11. Super keyword example
14. Right rotate array 12. Abstract class example
15. Count even and odd in array 13. Interface implementation
14. Multiple interfaces 11. Sort ArrayList
15. Polymorphism example 12. Remove duplicates using Set
16. Encapsulation example 13. Convert list to array
17. Inner class example 14. Frequency count using Map
18. Static nested class 15. Synchronize collection
19. Anonymous class and Object Multithreading
20. Object cloning 1. Thread creation (extends Thread)
21. Copy constructor 2. Thread creation (implements
22. Singleton class Runnable)
Exception Handling 3. Thread priorities
1. Try-catch example 4. Thread sleep
2. Multiple catch blocks 5. Join method
3. Nested try block 6. Daemon thread
4. Finally block usage 7. Synchronized method
5. Throw keyword 8. Synchronized block
6. Throws keyword 9. Inter-thread communication
7. Custom exception (wait/notify)
8. Arithmetic exception 10. Thread pool examplr
9. NullPointer exception Date, Time, Utility
10. ArrayIndexOutOfBounds 1. Get current date
11. NumberFormatException 2. Format date
12. InputMismatchException 3. Parse date
13. FileNotFoundException 4. Add days to date
14. Handle multiple exceptions 5. Compare two dates
File Handling 6. Find day of week
1. Read from file 7. Use Calendar class
2. Write to file 8. Use LocalDate
3. Append to file 9. Use LocalDateTime
4. Copy file 10. Use DateTimeFormatter
5. Count lines in file Miscellaneous & Advanced
6. Count words in file 1. Use Math class
7. Search word in file 2. Use Scanner class
8. Replace word in file 3. Use Random class
9. Delete a file 4. Calculator using switch
10. Rename a file 5. Binary to decimal
11. Create a directory 6. Decimal to binary
12. List files in directory 7. Matrix multiplication
13. File exists check 8. Matrix transpose
14. Read object from file (Serialization) 9. Bubble sort
15. Write object to file 10. Insertion sort
Collections
1. ArrayList example
2. LinkedList example
3. HashSet example
4. TreeSet example
5. HashMap example
6. TreeMap example
7. Stack example
8. Queue example
9. PriorityQueue example
10. Iterate HashMap
Logic & Number-Based Programs Object-Oriented & Misc. Logical
1. Print first N Armstrong numbers Programs
2. Find the Nth Fibonacci number using 31. Design a Student class with
recursion Comparable interface
3. Check if a number is Harshad (Niven) 32. Design a Singleton class (Thread-
4. Check if a number is Disarium safe)
5. Convert decimal to octal 33. Design an immutable class in Java
6. Convert decimal to hexadecimal 34. Implement a basic LRU cache
7. Convert binary to decimal 35. Implement a basic stack using Array
8. Reverse digits and check if prime 36. Implement a basic queue using
9. Check if a number is Happy Linked List
10. Convert number to words (e.g., 123 37. Find the number of objects created
→ One Two Three) from a class
String-Specific Interview Programs 38. Create a factory pattern
11. Reverse each word in a sentence implementation
12. Count the number of occurrences of a 39. Builder pattern implementation
word in sentence 40. Dependency injection using
13. Find the first non-repeating character constructors
in a string Recursion-Focused Programs
14. Remove all non-alphabet characters 41. Sum of digits using recursion
from a string 42. Print all subsets of a set (power set)
15. Compress a string using run-length 43. Solve Tower of Hanoi
encoding 44. Count number of zeros in an integer
16. Find duplicate words in a string using recursion
17. Print all permutations of a string 45. Calculate GCD using recursion
(recursive) Advanced Exception/File Handling
18. Find the longest substring without 46. Read CSV file and print data
repeating characters 47. Count characters, words, and lines
19. Check if two strings are rotations of from a text file
each other 48. Read a file and remove duplicate
20. Check if a string is isogram (no lines
repeating characters) 49. Encrypt and decrypt file content
Array/Matrix Programs (New) (basic Caesar cipher)
21. Find the majority element in an array 50. Custom checked vs unchecked
22. Find subarray with given sum exception demo
23. Kadane’s Algorithm – Maximum Advanced Threading/Concurrency
subarray sum (New)
24. Rearrange array in max/min form 51. Producer-consumer problem using
(alternating) wait/notify
25. Find intersection of two arrays 52. Print odd/even numbers using two
26. Find union of two arrays threads
27. Find duplicate element in an array of 53. Deadlock-free bank transfer
size n+1 simulation
28. Rotate a matrix 90 degrees clockwise 54. Implement thread-safe counter
29. Transpose of a matrix 55. Countdown latch example
30. Spiral print of a matrix

You might also like