Java Program Tutorial For Practice: If you have already learned the basics of Java, why not try solving some practice problems? Not only will this help you better understand and remember what you’ve learned, but it will also give you a chance to level up your programming abilities.
If you’re looking for some Java coding problems to practice, this Java Program Tutorial post has a great selection. The solutions and corresponding outputs are included so you can check your work. If you are new to Java and want to learn more about the Java programming language before trying out these programs, be sure to check out my Core Java Tutorials.
We have a range of Java examples to help you learn the language, including basic programs, array and number programs, math functions, string programs, inheritance, and exception handling programs. You can also find data structure topics like trees, heaps, linked lists, hash tables, stacks, and queues. Each sample program includes a description of the code output.
Java Program Tutorial
- How to reverse a string in java?
- How to create a pyramid of numbers in java?
- How do you remove all white spaces from a string in java?
- How to find duplicate characters in a string in java?
- How do you check the equality of two arrays in java?
- Anagram program in java
- Armstrong number program in java
- How to find duplicate elements in an array?
- How to find the sum of all digits of a number in java?
- How to find the second largest number in an integer array?
- How to perform matrix operations in java?
- How to count occurrences of each character in a string in java?
- How to find the largest number less than a given number and without a given digit?
- How to find all pairs of elements in an array whose sum is equal to a given number?
a
- How to find a continuous sub-array whose sum is equal to the given number?
- How to remove duplicate elements from ArrayList in java?
- How to check whether the given number is binary or not?
- How to check whether one string is a rotation of another in java?
- How to find an intersection of two arrays in java?
- How to check whether the user input is a number or not in java?
- How to find trigonometric values of an angle in java?
- How to reverse each word of a string in java?
- How do separate zeros from non-zeros in an array?
- Decimal To Binary, Decimal To Octal, And Decimal To HexaDecimal In Java
- How to find all the leaders in an integer array in java?
- Reverse and add until you get a palindrome
- Selection sort in java
- Reverse the string with preserving the position of the spaces
- Roman equivalent of a decimal number
- Percentage of uppercase, lowercase, digits, and special characters in a string
- Launch external applications through java code
- Find the missing number in an array
- String immutable program
- Arrays.deep string() method example.
- Java ArrayList Programming Examples.
- Java LinkedList Programming Examples.
- Detection of deadlocked threads
- Generate random numbers
- Java PriorityQueue Example.
- Java HashSet Example.
- Java LinkedHashSet Example.
- Java TreeSet Example.
- How to sort a text file in java?
- Array to ArrayList and ArrayList To Array Conversion program.
- How do you find the longest substring without repeating characters in a string?
- How do you count occurrences of each element in an array?
- Reverse an array.
- Write a java program to swap two string variables without using a third or temp variable.
- Write a java program to find the most repeated word in a text file.
- How do you stop a thread in java?
- Remove duplicate elements from an array.
- Write a java program to append text to a file.
- How do you synchronize ArrayList, HashSet, and HashMap in java?
- Write a java program to find several characters, the number of words, and the number of lines in a text file.
- How do you convert HashMap to ArrayList in java?
- Write a java program to sort an ArrayList?
- Write a java program to find all permutations of a string recursively.
- Write a java program to check whether a given number belongs to the Fibonacci series or not.
- Java HashMap programming examples.
- Write a java program to print Floyd’s Triangle.
- Find The First Repeated And Non-Repeated Character In A String?
- Write a java program to create a spiral of numbers or spiral matrix or circular matrix of order n*n in both clockwise and anti-clockwise directions.
- String to Integer and Integer to String Conversion program.
- Write a Code to generate Random numbers.
- Write code to verify whether a number is a perfect number or not.
- Fibonacci series from 1 to 10.
- Write a program to find a Factorial of a number.
- Swap two numbers without using the third variable.
- Program to find the greatest of three numbers.
- An Array of numbers was given. Find the largest two numbers and print it
- Reverse a number.
- Verify if a given number is a palindrome or not. (same concept of reversing a number)
- Armstrong number program.
- A String is given to remove the white spaces, reverse them and print the only odd position characters.
- Check if a string is an anagram of another string.
- A string is given to make a few characters to upper case as asked.
- In a String print the occurrence of each character.
- In a Statement check how any duplicate strings are there and remove them.
- Use split to print each word of a statement.
- Find the substring of a String.
- Remove duplicate characters from a string and print it.
- Write a code to print the triangle of numbers.
- Read and Write file program.
- Calculate the power of a number using a while loop
- Write a java program
- Print from 1 to 10 without using any loop
- Reverse a string without using built-in methods
- Reverse each word in a sentence(string)without changing the order of words
- Reverse a string without using any loop or built-in function
- Remove spaces from a string without using replace()
- Print occurrences of distinct letters present in the string
- Print the indexes of the specified letter in the string
- Print the returned indexes of 2 elements from an array[2,4,3,6,8,7] where the addition of 2 elements is equal to target sum=7
- Transpose a matrix using the 2D array concept
- Print the first repeated character from a string Ex: abcdcba, output:c
- Find whether the string is having unique characters or not
- Write a program to remove duplicates from an array without using the collection. (Note: new array should have its size equal to the unique number of elements present in the given array)
- Write a program to print the Fibonacci series
- Find and print the maximum character present in a string
Java Programs
Commonly asked Core Java Programs in Testing Interview:
- String s = “sub53od73th”; Eliminate the numbers alone.
- Java program: Reverse the words in the sentence.
- Java program: Find the count of each element in a two-dimensional matrix.
- Java Program: Find duplicate elements in an array of numbers.
- Write a program to find all options from a drop-down & then Sort them.
- Write a program to read/write data from a Property file?
- Java Program: Write 0 and 1 separately from 10011101101 and find the frequency of each
- Java Program: To print the frequency of words in a paragraph?
- How will you get the odd and even numbers in a given array? Write the program.
- How will you get the min and maximum number from a given array? Write a program?
- Write a program to reverse a string without using inbuilt functions.
- Write a program to find out the repeated character in a string.
- Write a program to delete duplicate values in a string array.
- Write a program for checking emails and deleting them.
- Write a Java program to check whether a year is a leap year or not.
- Write a Java program to see the output as 0,1,1,2,3.
- What is the toString() method? What happens when I use the program?
- Write a program to return the number of rows and columns in a web table.
- Write a program for removing white spaces in a String.
- Write a Java program for the pascal triangle.
- Write a Java program for sorting numbers.
- Write a Java program for searching a letter in a string.
- Write a Java program for sorting an array.
Other Java Programs:
- Java Program: Change a string such that the first character is upper case, the second is lower case, and so on.
- Java Program: To find duplicates between two lists.
- WAP to compare two Hashmap for equality?
- Java Program: Sort a string that has only 0, 1,2 in it. Sample input: 010201010100222112 | Sample output: 000000011111122222
- Java Program: String s = “sub53od73th”; Eliminate the numbers alone. Print the Alphabet.
- Write a program to get all the Links from a Webpage and then display them.
- Java program: Reverse the words in the sentence.
- Java program: Find the count of each element in a two-dimensional matrix.
- Java Program: Find duplicate elements in an array of numbers.
- Java Program: Identify if a String is a Palindrome. Print Factorial of a number.
- Java Program: Reverse a String.
- WAP to find ALL options from a dropdown & then Sort them.
- WAP to retrieve data from an Excel file.
- WAP to read/write data from a Property file.
- WAP for Anagram problem.
- Java Program: Write 0 and 1 separately from 10011101101 and find the frequency of each.
- Java Program: To print the frequency of words in a paragraph.
We Hope This series Of Java programs will help you face any Java programming questions in the interview. We know this is a small number of questions out of the Vast Programming language Java. But by joining you and our hands, we can try to reach 100%. So keep sharing the questions and solutions if you have.
Please give answers for all the questions so that it will easy for understanding the programs easily.
Hi Vijay,
We are working on that to add the solution for all the above programs… to get the update about these java programs for testers kindly subscribes the notification. So when we update this post you will get a notification
I just read this article and found it very useful and informative.