Basic Java String Programs #Sr.No. - Question
-
Write a JAVA program to reverse the given String S. Perform the reversal operation if and only if the string S is equivalent to S1 are equal. (Perform case-sensitive comparison). If the strings are not equal print “Reverse Not Supported”. Example: String S = “Hari”, S1 = “Wipro”, output should be “Reverse Not Supported”.
-
Write a JAVA program to count the total upper-case and lower-case characters of a String T. After counting, print them if and only if the count is not equal. If the count is equal, print “Equally Distributed”.
-
Create a JAVA program to split the strings based on the white-spaces, after the split operation, print the string with the smallest length.
-
Create a JAVA program to split the strings based on white-spaces, after the split operation, print all the strings in the dictionary order.
-
Toggle the strings using JAVA. Toggling is the process of converting the uppercase characters to lower case and vice versa.
-
Create a JAVA program to rotate the string by clock-wise direction if the length is even and to rotate the string to the anti-clockwise direction if the length is odd. Perform one rotation at any case.
-
Create a JAVA program to merge two given strings S1 and S2. Perform merge operation by taking single character from each string. Example: If the string S1 = “ABC”, S2= “DEF”, Output: ADBECF.
-
Create a JAVA program to find the maximum and minimum occurred character in a String.
-
Create a JAVA program to sort the characters of the string S. After sorting, extract the odd-positioned characters and store it into a string variable and print it.
-
Write a JAVA program to compute the string age. Age of the string can be calculated using the formula: Age = Length of the string S + Alphabetical index of the last-character. Example: If the string is “ABAB”, output = (4+2) = 6.