
Sit in on enough fresher interviews and you notice something: the programs rarely change. Reverse a number. Check a prime. Print Fibonacci. Find duplicates in an array. Interviewers are not testing whether you have seen the problem before. They are checking whether you can turn a simple idea into clean, working code, handle the edge cases and explain your thinking out loud.
This guide gives you the 15 Java programs most often asked in fresher interviews, grouped by type. Every program here was compiled and run, so the output shown is the real output. For each one you get the logic in plain words, the time complexity and the follow-up questions interviewers like to ask.
How to use it: type each program yourself instead of copying it. Run it, change the input, break it on purpose, and then explain it aloud as if you were in the interview room. That is the practice that actually works.

What This Guide Covers
• How to compile and run the programs on your own computer
• A simple method for answering any coding question in an interview
• 15 programs in four groups: numbers, strings, arrays and collections, and searching, sorting and patterns
• Time complexity explained in plain words, with a growth chart
• Common mistakes, Java concept questions, bonus programs and a 7-day practice plan
How to Run These Programs
You need the JDK (Java Development Kit), which includes the compiler. Install a recent long-term-support version from an official source, and check it by typing java -version in your terminal. The programs use only basic Java features, so they run on Java 8 and above. The outputs shown here were produced on Java 21.
Every program in this guide is written as a class named Main. Save it in a file called Main.java, then compile and run it:
javac Main.java
java Main
// On Java 11 and above, you can also run a single file directly:
java Main.java

To practise with different inputs, read them from the keyboard using Scanner. In interviews, though, hard-coding a few test values lets you focus on the logic.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number: ");
int n = sc.nextInt();
System.out.println("Square = " + (n * n));
}
}
You can also use an IDE such as IntelliJ IDEA Community Edition, Eclipse or VS Code with the Java extensions.
How to Answer a Coding Question in an Interview
Most freshers lose marks not because they cannot code, but because they start typing too early. Use this five-step habit for every program:
1. Clarify. Repeat the problem and ask about edge cases: negative numbers, zero, empty input, duplicates.
2. Work an example by hand. Take a small input and trace it on paper.
3. Explain your approach in two or three sentences before writing any code.
4. Write clean code with meaningful names, then trace your own example through it.
5. State the complexity and mention one possible improvement.
What a strong spoken answer sounds like (Program 3, prime check) "I need to check whether a number is prime. Numbers below 2 are not prime. For others, I will test divisibility from 2 up to the square root, because any larger factor always pairs with a smaller one. If anything divides it evenly, it is not prime. That takes O(square root of n) time and constant space. Let me test 1, 2, 17 and 25 to confirm." |
Part 1: Number Programs (Programs 1 to 6)
Program 1: Swap Two Numbers Without a Third Variable
Logic: Add both numbers and keep the sum in a. Subtracting the new b from the sum recovers the original a and puts it into b. Subtracting that from the sum gives the original b.
public class Main {
public static void main(String[] args) {
int a = 10, b = 25;
System.out.println("Before: a = " + a + ", b = " + b);
a = a + b; // a now holds the sum
b = a - b; // b becomes the old value of a
a = a - b; // a becomes the old value of b
System.out.println("After: a = " + a + ", b = " + b);
}
}
Output:
Before: a = 10, b = 25
After: a = 25, b = 10
Complexity: O(1) time and O(1) space.
Interviewers may ask: Can this overflow? Yes, a + b can exceed the int range for very large values. How else can you swap? With XOR (a = a ^ b; b = a ^ b; a = a ^ b), or most simply with a temporary variable, which is clearer in real code. A classic follow-up: can you write a swap(int a, int b) method? Not in Java, because primitives are passed by value, so the caller's variables do not change.
Program 2: Reverse a Number (and Check a Palindrome Number)
Logic: Take the last digit with n % 10, add it to the reversed number after multiplying that number by 10, then drop the last digit with n / 10. Repeat until n becomes 0. A palindrome number simply equals its own reverse.
public class Main {
static int reverse(int n) {
int rev = 0;
while (n != 0) {
int digit = n % 10; // take the last digit
rev = rev * 10 + digit; // append it to the reversed number
n = n / 10; // drop the last digit
}
return rev;
}
public static void main(String[] args) {
int number = 12345;
System.out.println("Reverse of " + number + " = " + reverse(number));
int n = 1221;
if (n == reverse(n)) {
System.out.println(n + " is a palindrome");
} else {
System.out.println(n + " is not a palindrome");
}
}
}
Output:
Reverse of 12345 = 54321
1221 is a palindrome
Complexity: O(d) time, where d is the number of digits, and O(1) space.
Interviewers may ask: What about negative numbers or very large ones? Reversing a value like 1534236469 overflows int, so use long when overflow is possible. Can you check a palindrome number without converting it to a String? Yes, exactly as shown here.
Program 3: Check Whether a Number Is Prime
Logic: A number is prime if it has no divisor between 2 and its square root. If it had a divisor larger than the square root, it would also have a smaller partner, so checking up to the square root is enough. Numbers below 2 are not prime.
public class Main {
static boolean isPrime(int n) {
if (n <= 1) return false;
for (int i = 2; (long) i * i <= n; i++) {
if (n % i == 0) return false; // found a divisor
}
return true;
}
public static void main(String[] args) {
int[] tests = {1, 2, 17, 25, 97};
for (int t : tests) {
System.out.println(t + " -> " + (isPrime(t) ? "Prime" : "Not prime"));
}
}
}
Output:
1 -> Not prime
2 -> Prime
17 -> Prime
25 -> Not prime
97 -> Prime
Complexity: O(square root of n) time and O(1) space.
Interviewers may ask: Why check only up to the square root? (Explain the factor-pair idea.) Why the cast to long in (long) i * i? It prevents overflow for numbers close to the int limit. How would you print all primes up to n? The Sieve of Eratosthenes is the standard answer.
Program 4: Print the Fibonacci Series
Logic: Keep the last two numbers. Print the first, compute the next as their sum, then shift the pair forward. Starting with 0 and 1, each new term is the sum of the previous two.
public class Main {
public static void main(String[] args) {
int count = 10;
long first = 0, second = 1;
System.out.print("Fibonacci series: ");
for (int i = 1; i <= count; i++) {
System.out.print(first + " ");
long next = first + second;
first = second;
second = next;
}
System.out.println();
}
}
Output:
Fibonacci series: 0 1 1 2 3 5 8 13 21 34
Complexity: O(n) time and O(1) space.
Interviewers may ask: How would you write it with recursion? A simple recursive version recomputes the same values again and again, so it takes exponential time. You can fix that with memoization or dynamic programming. Why long instead of int? The values grow quickly, and long holds terms up to the 92nd Fibonacci number (counting 0 as the zeroth).
Program 5: Factorial Using Recursion
Logic: A recursive function solves a problem by calling itself on a smaller input. n! equals n times (n minus 1)!, and the base case 0! = 1! = 1 stops the recursion.
public class Main {
static long factorial(int n) {
if (n == 0 || n == 1) {
return 1; // base case
}
return n * factorial(n - 1); // recursive call
}
public static void main(String[] args) {
System.out.println("5! = " + factorial(5));
System.out.println("10! = " + factorial(10));
System.out.println("20! = " + factorial(20));
}
}
Output:
5! = 120
10! = 3628800
20! = 2432902008176640000
Complexity: O(n) time and O(n) space, because each pending call uses stack memory.
Interviewers may ask: What happens without a base case? The calls never stop and Java throws a StackOverflowError. What is the largest factorial a long can hold? 20!. From 21! onward it overflows, so use BigInteger. How would you write it iteratively? With a simple loop, which uses O(1) extra space.

Program 6: Check an Armstrong Number
Logic: An Armstrong number equals the sum of its digits, each raised to the power of the number of digits. For example, 153 = 1³ + 5³ + 3³ = 1 + 125 + 27, and 9474 = 9⁴ + 4⁴ + 7⁴ + 4⁴.
public class Main {
static boolean isArmstrong(int n) {
int original = n;
int digits = String.valueOf(n).length();
int sum = 0;
while (n > 0) {
int digit = n % 10;
sum += (int) Math.pow(digit, digits);
n = n / 10;
}
return sum == original;
}
public static void main(String[] args) {
int[] tests = {153, 370, 9474, 123};
for (int t : tests) {
String result = isArmstrong(t) ? "Armstrong" : "Not Armstrong";
System.out.println(t + " -> " + result);
}
}
}
Output:
153 -> Armstrong
370 -> Armstrong
9474 -> Armstrong
123 -> Not Armstrong
Complexity: O(d) time and O(1) space, where d is the number of digits.
Interviewers may ask: How would you print all Armstrong numbers in a range? Loop over the range and call this method on each number. Why cast Math.pow to int? Because it returns a double. For very large numbers you might write your own integer power method to avoid precision issues.
Part 2: String Programs (Programs 7 to 9)
Program 7: Check Whether a String Is a Palindrome
Logic: Clean the string first by removing non-alphanumeric characters and converting to lowercase. Then compare the first and last characters, moving inward with two pointers. If any pair differs, it is not a palindrome.
public class Main {
static boolean isPalindrome(String s) {
String clean = s.replaceAll("[^A-Za-z0-9]", "").toLowerCase();
int left = 0, right = clean.length() - 1;
while (left < right) {
if (clean.charAt(left) != clean.charAt(right)) {
return false;
}
left++;
right--;
}
return true;
}
public static void main(String[] args) {
String[] tests = {"Madam", "A man, a plan, a canal: Panama", "Pune"};
for (String t : tests) {
System.out.println("\"" + t + "\" -> " + isPalindrome(t));
}
}
}
Output:
"Madam" -> true
"A man, a plan, a canal: Panama" -> true
"Pune" -> false
Complexity: O(n) time and O(n) space for the cleaned copy.
Interviewers may ask: Can you do it without the extra copy? Yes, by moving two pointers inward and skipping characters that are not letters or digits. What if the input is null or empty? Handle null explicitly, and note that an empty string counts as a palindrome. How is this different from simply reversing the string with StringBuilder? The reverse method is shorter, but interviewers often want the logic first.
Program 8: Count Vowels and Consonants
Logic: Convert the text to lowercase and loop through each character. Count it only if it is a letter, then check whether it appears in "aeiou". Spaces, digits and symbols are ignored.
public class Main {
public static void main(String[] args) {
String text = "Hello World from Pune";
int vowels = 0, consonants = 0;
for (char ch : text.toLowerCase().toCharArray()) {
if (ch >= 'a' && ch <= 'z') { // ignore spaces and symbols
if ("aeiou".indexOf(ch) != -1) {
vowels++;
} else {
consonants++;
}
}
}
System.out.println("Vowels: " + vowels);
System.out.println("Consonants: " + consonants);
}
}
Output:
Vowels: 6
Consonants: 12
Complexity: O(n) time and O(1) space.
Interviewers may ask: How do you handle capital letters? toLowerCase() makes the check case-insensitive. Can you also count digits and spaces? Yes, with extra conditions. Could you write it with a switch statement? Yes, with cases for a, e, i, o and u.
Program 9: Check Whether Two Strings Are Anagrams
Logic: Two strings are anagrams if they contain exactly the same letters in different order. Remove spaces, convert to lowercase, sort both character arrays and compare them.
import java.util.Arrays;
public class Main {
static boolean isAnagram(String a, String b) {
a = a.replaceAll("\\s", "").toLowerCase();
b = b.replaceAll("\\s", "").toLowerCase();
if (a.length() != b.length()) return false;
char[] x = a.toCharArray();
char[] y = b.toCharArray();
Arrays.sort(x);
Arrays.sort(y);
return Arrays.equals(x, y);
}
public static void main(String[] args) {
System.out.println(isAnagram("Listen", "Silent"));
System.out.println(isAnagram("Dormitory", "Dirty room"));
System.out.println(isAnagram("Hello", "World"));
}
}
Output:
true
true
false
Complexity: O(n log n) time because of the sorting, and O(n) space.
Interviewers may ask: Can you do better than sorting? Yes. Count the letters of the first string in an int[26] array, subtract for the second, and check that every count is zero. That runs in O(n) time. How would you handle non-English characters? A HashMap of character counts works for any character set.
Part 3: Arrays and Collections (Programs 10 to 12)
Program 10: Find the Largest and Second Largest Element
Logic: Make a single pass. Keep the largest and second largest values seen so far. When a bigger number arrives, the old largest becomes second. Otherwise, update second only if the number is larger than it and different from the largest.
public class Main {
public static void main(String[] args) {
int[] arr = {12, 35, 1, 10, 34, 35, 7};
int largest = Integer.MIN_VALUE;
int second = Integer.MIN_VALUE;
for (int n : arr) {
if (n > largest) {
second = largest;
largest = n;
} else if (n > second && n != largest) {
second = n;
}
}
System.out.println("Largest: " + largest);
System.out.println("Second largest: " + second);
}
}
Output:
Largest: 35
Second largest: 34
Complexity: O(n) time and O(1) space, with no sorting needed.
Interviewers may ask: Why not just sort the array? Sorting works but costs O(n log n), while one pass costs O(n). What about duplicates? That is why the n != largest check is there. What if the array has fewer than two distinct values? Then the second largest does not exist, so check for that case. How would you find the Nth largest? Use sorting or a min-heap of size N.
Program 11: Find Duplicate Elements in an Array
Logic: A HashSet stores each value only once. Its add() method returns false when the value is already present, which tells you that you have found a duplicate.
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
public class Main {
public static void main(String[] args) {
int[] arr = {4, 2, 7, 2, 9, 4, 1, 7};
Set<Integer> seen = new HashSet<>();
Set<Integer> duplicates = new LinkedHashSet<>();
for (int n : arr) {
if (!seen.add(n)) { // add() returns false if already present
duplicates.add(n);
}
}
System.out.println("Duplicate elements: " + duplicates);
}
}
Output:
Duplicate elements: [2, 4, 7]
Complexity: O(n) average time and O(n) extra space.
Interviewers may ask: Can you solve it without extra memory? Sort the array first, then compare neighbours, at O(n log n) time. Why LinkedHashSet for the result? It keeps insertion order, while HashSet does not guarantee any order.
Program 12: Count Character Frequency Using a HashMap
Logic: Use a map from character to count. For each character, read its current count (defaulting to 0 with getOrDefault), add one and store it back. LinkedHashMap keeps the characters in the order they first appear.
import java.util.LinkedHashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
String text = "programming";
Map<Character, Integer> freq = new LinkedHashMap<>();
for (char ch : text.toCharArray()) {
freq.put(ch, freq.getOrDefault(ch, 0) + 1);
}
for (Map.Entry<Character, Integer> e : freq.entrySet()) {
System.out.println(e.getKey() + " -> " + e.getValue());
}
}
}
Output:
p -> 1
r -> 2
o -> 1
g -> 2
a -> 1
m -> 2
i -> 1
n -> 1
Complexity: O(n) time and O(k) space, where k is the number of distinct characters.
Interviewers may ask: How would you find the first non-repeating character? Build the frequency map, then scan the string again and return the first character with a count of 1. What is the difference between HashMap, LinkedHashMap and TreeMap? Unordered, insertion order, and sorted by key.
Part 4: Searching, Sorting and Patterns (Programs 13 to 15)
Program 13: Binary Search
Logic: On a sorted array, look at the middle element. If it equals the target, you are done. If it is smaller, the target must be in the right half. If it is larger, it must be in the left half. Each step halves the search space.
public class Main {
static int binarySearch(int[] arr, int target) {
int low = 0, high = arr.length - 1;
while (low <= high) {
int mid = low + (high - low) / 2; // avoids integer overflow
if (arr[mid] == target) {
return mid;
} else if (arr[mid] < target) {
low = mid + 1; // search the right half
} else {
high = mid - 1; // search the left half
}
}
return -1; // not found
}
public static void main(String[] args) {
int[] sorted = {3, 8, 15, 21, 27, 34, 42};
System.out.println("Index of 27: " + binarySearch(sorted, 27));
System.out.println("Index of 10: " + binarySearch(sorted, 10));
}
}
Output:
Index of 27: 4
Index of 10: -1
Complexity: O(log n) time and O(1) space.
Interviewers may ask: What is the one requirement? The array must be sorted. Why write mid as low + (high - low) / 2? It avoids integer overflow that (low + high) / 2 can cause. How would you find the first occurrence when duplicates exist? Keep searching the left half after a match. Does Java have a built-in? Yes, Arrays.binarySearch().
Program 14: Bubble Sort
Logic: Repeatedly compare neighbouring elements and swap them if they are in the wrong order. After each pass, the largest remaining element settles at the end. If a full pass makes no swaps, the array is already sorted and the loop stops early.
import java.util.Arrays;
public class Main {
static void bubbleSort(int[] arr) {
int n = arr.length;
for (int i = 0; i < n - 1; i++) {
boolean swapped = false;
for (int j = 0; j < n - 1 - i; j++) {
if (arr[j] > arr[j + 1]) {
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
swapped = true;
}
}
if (!swapped) break; // already sorted, stop early
}
}
public static void main(String[] args) {
int[] arr = {64, 25, 12, 22, 11};
System.out.println("Before: " + Arrays.toString(arr));
bubbleSort(arr);
System.out.println("After: " + Arrays.toString(arr));
}
}
Output:
Before: [64, 25, 12, 22, 11]
After: [11, 12, 22, 25, 64]
Complexity: O(n²) time in the worst and average cases, O(n) in the best case thanks to the early exit, and O(1) space.
Interviewers may ask: Is bubble sort stable? Yes. Can you name faster algorithms? Merge sort and quick sort run in O(n log n) on average. What does Arrays.sort() do in practice? It uses highly optimised algorithms, so in real code you rarely write your own sort. Be ready to write selection sort or insertion sort as well.
Program 15: Print a Pyramid Pattern
Logic: Use one outer loop for the rows and two inner loops: one prints the leading spaces (rows minus the current row) and one prints the stars (2 times the current row, minus 1).
public class Main {
public static void main(String[] args) {
int rows = 5;
for (int i = 1; i <= rows; i++) {
for (int s = 1; s <= rows - i; s++) {
System.out.print(" "); // leading spaces
}
for (int k = 1; k <= 2 * i - 1; k++) {
System.out.print("*"); // stars for this row
}
System.out.println();
}
}
}
Output:
*
***
*****
*******
*********
Complexity: O(rows²) time.
Interviewers may ask: Can you print an inverted pyramid, a diamond or a number pattern? The same method applies. Tip: before coding any pattern, write a small table of row number, spaces and stars on paper. The formulas appear immediately.
Understanding Time Complexity in Plain Words
Interviewers often end with "What is the time complexity?" You do not need a mathematics degree to answer. Look at your loops:
• No loop, or a fixed number of steps: O(1), like the swap.
• One loop over the input: O(n), like finding the largest element.
• A loop that halves the problem each time: O(log n), like binary search.
• A sort inside your solution: usually O(n log n), like the sort-based anagram check.
• A loop inside a loop: O(n²), like bubble sort.

The chart shows why complexity matters. A small input hides the difference, but as the input grows, the O(n²) curve rises far faster than the others.
Common Mistakes in Java Coding Rounds
• Ignoring edge cases: zero, negative numbers, empty strings, null and arrays with one element.
• Integer overflow: int silently wraps around. Use long, or BigInteger for very large values.
• Off-by-one errors in loop limits. Trace the first and last iterations by hand.
• Comparing strings with ==. Use equals(). The == operator compares references, not content.
• Forgetting the base case in recursion.
• Writing code in silence. Explaining as you go earns marks even when a detail is wrong.
• Hard-coding for one example instead of writing a method that works for any input.
• Memorising instead of understanding. One follow-up question exposes it.
Java Questions Interviewers Ask Around These Programs
After the coding, many interviewers ask short concept questions. Here are six, with answers you can adapt:
Why is String immutable in Java? Once created, a String cannot change. This makes strings safe to share between threads, lets Java reuse them from the string pool, and keeps them safe as keys in hash-based collections.
What is the difference between == and equals()? For objects, == compares references (whether both variables point to the same object), while equals() compares content when a class overrides it. Always compare String values with equals().
When should you use StringBuilder instead of String? When you modify text repeatedly, such as inside a loop. String concatenation creates a new object each time, while StringBuilder changes one buffer.
HashSet or ArrayList? A HashSet stores unique values and has fast average lookup but no guaranteed order. An ArrayList keeps insertion order, allows duplicates and needs a scan to search.
HashMap, LinkedHashMap or TreeMap? HashMap has no guaranteed order, LinkedHashMap keeps insertion order, and TreeMap keeps keys sorted.
What is the difference between int and Integer? int is a primitive value. Integer is a wrapper object that can be null and is required for collections like List and Map. Java converts between them automatically through autoboxing.
12 More Programs to Practise After These
• GCD and LCM of two numbers
• Sum of digits of a number
• Leap year check
• Linear search, selection sort and insertion sort
• Reverse an array in place
• Merge two sorted arrays
• First non-repeating character in a string
• Find the missing number in an array of 1 to n
• Matrix addition and transpose
• Pascal's triangle
• Count the words in a sentence
• FizzBuzz
Your 7-Day Practice Plan
• Day 1: Programs 1 to 3. Type, run and explain each one aloud.
• Day 2: Programs 4 to 6, including the recursion diagram.
• Day 3: Programs 7 to 9. Try the counting-array version of the anagram check.
• Day 4: Programs 10 to 12. Practise explaining the HashSet and HashMap choices.
• Day 5: Programs 13 to 15. Draw binary search and the pyramid on paper first.
• Day 6: write any five programs from memory, without help, and note where you get stuck.
• Day 7: solve three programs from the bonus list, 20 minutes each, speaking your approach aloud as if in an interview.
How to Show This Practice on Your Resume
Listing "Java" in a skills line proves little. Showing practice proves more. Create a GitHub repository named something like java-interview-practice, add each program as a separate file, and include a README that lists the problem, the approach, the complexity and the sample output. Then mention it honestly on your resume, for example: "Implemented 40+ core Java programs (recursion, searching, sorting, collections) with documented time complexity; repository on GitHub." Use a number only if it is true.
Where Structured Guidance Can Help
Practising alone works, but it is hard to judge your own explanations. If you would like guided learning, a centre such as upGrad Learning Support Centre, Pune can be a useful next step to explore, especially if you want structured practice, project work and interview feedback.
Structured programmes in areas like full stack development, data and AI/ML generally combine a planned curriculum, hands-on projects, mentor guidance and interview preparation. Course content, fees, schedules and eligibility can change, so confirm the latest details directly with the centre.
Before joining any programme, ask whether you will build real projects and get feedback on them, whether mock interviews are included, and whether the curriculum matches what employers ask for today. Be cautious about anyone who guarantees a job, interviews or a salary, because nobody can honestly promise that.
Get Regular Job Updates
Looking for regular IT job updates, fresher opportunities, and career-related updates? Join our WhatsApp group for more job updates and opportunities.
Join our WhatsApp Group: https://chat.whatsapp.com/KA8HpgjbJ67I5yfQDquCvn
Frequently Asked Questions (FAQs)
Q. Which Java programs are asked most in fresher interviews?
The most common are Fibonacci, prime number, factorial, palindrome, Armstrong number, string reversal, anagram, finding duplicates, largest element, searching, sorting and pattern printing. All of them are covered in this guide.
Q. Do I need to memorise these programs?
No. Understand the logic and the pattern behind each one. Memorised code usually fails when the interviewer asks a follow-up or changes the problem slightly.
Q. Can I use built-in methods like StringBuilder.reverse() in an interview?
It is best to ask. Many interviewers want to see the logic first, so write the manual version and mention that you also know the built-in option.
Q. How many programs should I practise before interviews?
Quality matters more than quantity. Work through these 15 and the 12 bonus programs, and practise variations of each. Being able to explain a program clearly is worth more than solving a hundred in silence.
Q. Should I use Scanner for input in interviews?
Usually hard-coding a few test values is fine and keeps the focus on logic. Mention that you can read input with Scanner if the interviewer wants it.
Q. What if I get stuck in the middle of a program?
Stay calm and talk through what you know. Write the simplest working version first, even if it is slow, then improve it. Interviewers value visible problem-solving.
Q. How do I explain time complexity if I am not confident with Big-O?
Describe your loops in plain words. One loop over the input is linear, a loop inside a loop is quadratic, and a loop that halves the input each time is logarithmic.
Q. Is Java still worth learning for freshers?
Java is widely used in enterprise software, and many fresher job postings list it, so it remains a practical choice. Check the job descriptions for the roles you want and learn the language they ask for.
Conclusion
The Java programs asked in fresher interviews follow a handful of patterns: digit loops, recursion, two pointers, counting with sets and maps, binary search, simple sorting and nested loops for patterns. Learn the pattern, understand why it works and practise explaining it, and the exact question stops mattering.
Your next step is simple. Set up Java today, type Programs 1 to 3, run them, and start the 7-day plan. Then put your practice on GitHub. If you want mentor feedback and structured interview practice, you can also explore what upGrad Learning Support Centre, Pune offers for your chosen path.
And if you want regular job and fresher opportunity updates, use the WhatsApp group link in the "Get Regular Job Updates" section above.


