Category: Java
-
How to find the pairs of numbers from an array whose sum is divisible by 9
This is the second solution to find the pairs of numbers in which their sum is divisible by 9 from an array of integers. This method uses the core logic of traversing array using nested for loops, add any two numbers come across in each iteration, and then uses a simple predicate to verify that…
-
How to check whether a given integer is prime number or not
This is the second solution to find whether the given integer number is prime or not using a simple predicate and another core logic that no number is divisible by more than half of itself.
-
How to find strings with no vowels in a file
This is the second solution to find all the strings with no vowels, in a given file. This approach uses the FileReader, Scanner, StringTokenizer, and Pattern class of Java regular expressions.
-
How to count number of occurrences of a given word in a file
This is the second solution to count the number of occurrences of a given string in the file. This approach uses the FileReader, Scanner, and String class methods.
-
How to find and replace a given string with new string in a file
This is the second solution to find and replace a given string with a new string in a file. This approach uses the FileReader, Scanner, FileWriter, BufferedWriter, and String methods.
-
How to count number of lines, words and characters in a file
This is the first solution to count number of lines, words and characters in a given file. This approach uses the FileReader, BufferedReader, StringTokenizer and String methods.
-
How to find strings with no vowels in a file
This is the first solution to find all the strings with no vowels, in a given file. This approach uses the FileReader, BufferedReader, StringTokenizer and StringBuffer methods.
-
How to find and replace a given string with new string in a file
This is the first solution to find and replace a given string with a new string in a file. This approach uses the FileReader, BufferedReader, FileWriter, BufferedWriter, and StringBuffer methods.
-
How to reverse all the numbers in an array of integers
This is the first solution to reverse all the numbers. This solution modifies the same array. The resultant array has all the numbers reversed.
-
How to count number of occurrences of a given word in a file
This is the first solution to count the number of occurrences of a given word in the file. This approach uses the FileReader, BufferedReader, and string buffer methods.
