P2Cart Logo
A non-palindrome word can be made a palindrome word just by adding the reverse of the word with the original word.

Here's a Java program that accepts a non-palindrome word and displays the new word after making it a palindrome by adding the reverse of the word to the original word.

Read more
A non-palindrome word can be made a palindrome word just by adding the reverse of the word with the original word. Write a program to accept a non-palindrome word and display the new word after making it a palindrome.
Sample Input: ICSE
Sample Output: The new word after making it a palindrome is: ICSEESCI

Read Answer
Write a program to input a string and display the frequency of vowels of each word present in the string.

Here’s a Java program that takes a string input and displays the frequency of vowels for each word present in that string:

Read more
Write a program to input a string and display the frequency of vowels of each word present in the string.
Sample Input: MASTERING INFORMATION TECHNOLOGY
Sample Output: Number of vowels present in MASTERING = 3
                            Number of vowels present in INFORMATION = 5
                            Number of vowels present in TECHNOLOGY = 3

Read Answer
A string is said to be ‘Unique’ if none of the alphabets present in the string are repeated.

Here's a Java program that accepts a string and checks whether it is "Unique," meaning none of the characters in the string are repeated:

Read more
A string is said to be ‘Unique’ if none of the alphabets present in the string are repeated. Write a program to accept a string and check whether the string is Unique or not. The program displays a message accordingly.
Sample Input: COMPUTER
Sample Output: Unique String

Read Answer
Accept a word and display the new word after removing all the repeated alphabets.

This Java program removes all repeated alphabets from a given word while preserving the order of their first occurrences.

Read more
Write a program to accept a word and display the new word after removing all the repeated alphabets.
Sample Input: applications
Sample Output: aplictons

Read Answer
Accept a word and convert it into lowercase, if it is in upper case.

This Java program accepts a word, converts it to lowercase if it's in uppercase, and replaces each vowel with the next character in the alphabet, displaying the modified word as output.

Read more
Write a program to accept a word and convert it into lowercase, if it is in upper case. Display the new word by replacing only the vowels with the character following it.
Sample Input: computer
Sample Output:  cpmpvtfr

Read Answer
A computer typist has the habit of deleting the middle name ‘Kumar’ while entering the names containing three words.

This Java program accepts a three-word name from the user and removes the middle name "Kumar," displaying the resulting name without it.

Read more
A computer typist has the habit of deleting the middle name ‘Kumar’ while entering the names containing three words. Write a program to enter a name with three words and display the new name after deleting the middle name ‘Kumar’.
Sample Input: Ashish Kumar Nehra
Sample Output: Ashish Nehra

Read Answer
Write a program to accept a sample string and replace the word Blue with Red.

This Java program demonstrates how to manipulate strings by replacing all occurrences of a specified word in a given text. In this case, the word "Blue" is replaced with "Red", and the updated string is displayed as the output.

Read more
Consider the string as:
Blue bottle is in Blue bag lying on Blue carpet
Write a program to accept a sample string and replace the word Blue with Red. The new string is displayed as:

Red bottle is in Red bag lying on Red carpet
Read Answer
Write a program to input a string and print the word containing the maximum vowels.

This program takes a string input from the user and determines which word contains the maximum number of vowels. It splits the string into individual words and counts the vowels in each word. The word with the highest vowel count is then displayed as the output.

Read more
Write a program to input a string and print the word containing the maximum vowels.
Sample Input: HAPPY NEW YEAR
Sample Output: The word with a maximum number of vowels: YEAR

Read Answer
Write a program to input a string and print the character that occurs the maximum number of times within a string.

This Java program counts the occurrences of each character in a given string and identifies the character that appears the most frequently, excluding spaces.

Read more
Write a program to input a string and print the character that occurs the maximum number of times within a string.
Sample Input: James Gosling developed Java
Sample Output: The character with the maximum number of times: e

Read Answer
Write a program to replace all the zeros (0) with ‘O’ and display the new String as:

This Java program takes a predefined string with the digit 0 and replaces it with the letter O, displaying the corrected string.

Read more
A computer operator has typed 0(zero) in place of ‘O’ in a given string. The String is typed as:
WELC0ME T0 BIRLA PLANETARIUM
Write a program to replace all the zeros (0) with ‘O’ and display the new String as:

WELCOME TO BIRLA PLANETARIUM
Read Answer
Enter a String and Display all the palindrome words present in the String.

This Java program accepts a sentence and displays each word that is a palindrome, i.e., reads the same forward and backward.

Read more
Write a program in Java to enter a String and Display all the palindrome words present in the String.
Sample Input: MOM AND DAD ARE NOT AT HOME
Sample Output: MOM
                             DAD

Read Answer
Enter a String and Frame a word by joining all the first characters of each word. Display the new word.

This Java program accepts a sentence, extracts the first character of each word, and joins them together to form and display a new word.

Read more
Write a program in Java to enter a String and Frame a word by joining all the first characters of each word. Display the new word.
Sample Input: Vital Information Resource Under Seize
Sample Output: VIRUS

Read Answer
Write a program in Java to accept a String in upper case and replace all the vowels with the Asterisk (*) present in the String.

This Java program accepts an uppercase string and replaces all vowels (A, E, I, O, U) with an asterisk (*).

Read more
Write a program in Java to accept a String in upper case and replace all the vowels with the Asterisk (*) present in the String.
Sample Input: “TATA STEEL IS IN JAMSHEDPUR”
Sample Output: T*T* ST**L *S *N J*MSH*DP*R 

Read Answer
Write a program in Java to accept a word and display the ASCII of each character.

This Java program accepts a word and prints the ASCII value of each character within it, displaying each character’s ASCII code in a formatted manner.

Read more
 Write a program in Java to accept a word and display the ASCII of each character.
Sample Input: BLUEJ
Sample Output: ASCII of B = 66
                             ASCII of L = 75
                             ASCII of U = 84
                             ASCII of E = 69
                             ASCII of J = 73
Read Answer
Convert all characters of the words in lowercase

This Java program accepts an uppercase sentence and converts it to title case, keeping only the first letter of each word in uppercase and the rest in lowercase, for a neatly formatted output.

Read more
Write a program in Java to accept a String as:
“IF IT RAINS, YOU WILL NOT GO TO PLAY”
Convert all characters of the words in lowercase other than the first characters to obtain the following output:

Sample Output: If It Rains, You Will Not Go To Play
Read Answer
Write a program in Java to accept a String in upper case and find the frequency of each vowel present in the String.

This Java program accepts an uppercase string and calculates the frequency of each vowel (A, E, I, O, U) in the string, then displays the results in a clear format.

Read more

Write a program in Java to accept a String in upper case and find the frequency of each vowel present in the String.

Sample Input: “RAIN WATER HARVESTING ORGANISED BY JUSCO”

Sample Output: Frequency of  ‘A’ = 4

Frequency of  ‘E’ = 3

Frequency of  ‘I’ = 3

Frequency of  ‘O’ = 2

Frequency of  ‘U’ = 1

Read Answer
Write a program in Java to enter a String/Sentence and display the longest word and the length of the longest word present in the String.

This Java program accepts a string or sentence from the user and identifies the longest word within it, displaying both the word and its length.

Read more
Write a program in Java to enter a String/Sentence and display the longest word and the length of the longest word present in the String.
Sample Input: “TATA FOOTBALL ACADEMY WILL PLAY
AGAINEST MOHAN BAGAN”
Sample Output: The longest word: FOOTBALL: The length of the word: 8

Read Answer
A man has written a statement as “My name is Alok Kumar Gupta and my age is 45 years”.

This Java program corrects the name and age in a given statement and displays the updated version.

Read more
A man has written a statement as “My name is Alok Kumar Gupta and my age is 45 years”. Later on, he realized that he had declared his name as Alok instead of Ashok and the age 45 instead of 35. Write a program in Java to correct his age in the predicted statement. Display the output as: My name is Ashok Kumar Gupta and my age is 35 years.
Read Answer
Accept a sentence and find the frequency of a given alphabet.

This Java program counts the frequency of a specified alphabet in a user-input sentence, taking into account case insensitivity.

Read more
Write a program in Java to accept a sentence and find the frequency of a given alphabet.
Sample Input: WE ARE LIVING IN COMPUTER WORLD.
                        : Enter an alphabet whose frequency is to be checked (Say: E).
Sample Output: The frequency is ‘E’ is 3.

Read Answer
Accept a name containing three words and display the surname first followed by the first and middle names.

This program allows users to input a name with three words and displays the surname first, followed by the first and middle names, demonstrating basic string manipulation in Java.

Read more
Write a program in Java to accept a name containing three words and display the surname first followed by the first and middle names.
Sample Input: MOHANDAS KARAMCHAND GANDHI
Sample Output: GANDHI MOHANDAS KARAMCHAND

Read Answer