P2Cart Logo
Write a program in Java to accept a name (Containing three words) and display only the initials.

This Java program takes a name consisting of three words and extracts the initials from each word, displaying them in a formatted manner.

Read more
Write a program in Java to accept a name (Containing three words) and display only the initials (i.e.: first alphabet of each word).
Sample Input: LAL KRISHNA ADVANI
Sample Output: L K A

Read Answer
Write a program in Java to accept a word/string.

This Java program takes a word or string input from the user and counts all the alphabets excluding vowels, providing the count as output.

Read more
Write a program in Java to accept a word/string. Count all the alphabets excluding vowels present in the word/string and display the result.
Sample Input: Happy New Year
Sample Output: No. of alphabets excluding vowels = 8 

Read Answer
Accept a word/a String and display the new string after removing all the vowels present in it.

Here’s a Java program that accepts a string and removes all the vowels from it, displaying the new string without vowels.

Read more
Write a program in Java to accept a word/a String and display the new string after removing all the vowels present in it.
Sample Input: COMPUTER APPLICATION
Sample Output: CMPTR          PPLCTNS

Read Answer
Write a program to accept a character.

This Java program checks the type of a given character, determining if it is a letter (and its case), a digit, or a special character. It provides clear feedback to the user based on their input.

Read more
Write a program to accept a character. If it is a letter, then display the case (i.e.: lower or upper case), otherwise check whether it is a digit or a special character.
Sample Input: p
Sample Output: p is a letter.
                            p is in lowercase.

Read Answer
Write a program to input an alphabet in upper case or in lower case.

This Java program prompts the user for an uppercase or lowercase letter and displays the next letter in the alphabet. It handles cases where the input is 'z' or 'Z', wrapping around to 'a' or 'A'.

Read more

Write a program to input an alphabet in upper case or lower case. Display the next alphabet accordingly. (i.e.: ‘a’ follows ‘b’, ……….. ‘z’ follows ‘a’).

Read Answer
Accept two different characters and display the sum and difference of their ASCII value.

This Java program accepts two different characters from the user and calculates their ASCII values. It then displays the sum and absolute difference of these values, providing a clear understanding of their numerical representation in the ASCII table.

Read more
Write a program to accept two different characters and display the sum and difference of their ASCII value.
Sample Input: B
                          d
Sample Output: The sum of ASCII value = 165
                             The difference of ASCII value = 35

Read Answer
Raj Kishore is an Assistant in the office.

This Java program inserts the middle name "KUMAR" in an employee’s name with two words, ensuring it follows a three-word full name format for consistency.

Read more
Raj Kishore is an Assistant in the office. He has the habit of writing the names of an employee by eliminating the middle name “KUMAR”. Write a program in Java to accept the names insert the middle name ‘KUMAR’ and display the full name. Consider that the name of an employee contains three words.
Sample Input: DILIP DEY
Sample Output: DILIP KUMAR DEY

Read Answer
Convert all the first characters of the String in upper case and display the new String.

This Java program capitalizes the first character of each word in a lowercase sentence. Useful for formatting strings, it provides step-by-step handling and displays the modified sentence.

Read more
Write a program in Java to accept a String in lowercase. Convert all the first characters of the String in upper case and display the new String.
Sample Input: understanding computer applications with Bluej
Sample Output: Understanding Computer Applications With Bluej

Read Answer
Enter a String. Print the String in alphabetical order of its alphabet.

This Java program sorts the characters of an input string in alphabetical order using Arrays.sort() and displays the sorted string for easy learning and demonstration.

Read more
Write a program in Java to enter a String. Print the String in alphabetical order of its alphabet.
Sample Input: COMPUTER
Sample Output: CEMOPRTU

Read Answer
Accept a word and check whether the word is Palindrome or not.

This Java program checks if a word is a palindrome by comparing characters from both ends of the string, determining if it reads the same forwards and backwards.

Read more
Write a program in Java to accept a word and check whether the word is Palindrome or not.
Sample Input: madam
Sample Output: madam

(A word is said to be Palindrome if the new word formed after reversing the alphabet is the same as the original word).
Read Answer
Write a program in Java to accept a word and display the same in Pig Latin.

This Java program converts a given word into Pig Latin by locating the first vowel, moving preceding characters to the end, and appending "ay." The result follows the common Pig Latin format for easy learning.

Read more
Write a program in Java to accept a word and display the same in Pig Latin.
Sample Input: trouble
Sample Output: oubletray

Pig Latin: A word is said to be in Pig Latin which is obtained by framing a new word with the first vowel present in the word with the remaining “letters” present before the first vowel and ending with ‘ay’.
Read Answer
Write a program to change 26 to 15, January to August, Republic to Independence and finally print “ August 15 is celebrated as the Independence Day of India”.

This Java program demonstrates how to modify specific words and numbers within a sentence, converting a Republic Day statement into an Independence Day message by replacing dates and terms.

Read more
Consider the following statement:
January 26 is celebrated as the Republic Day of India
Write a program to change 26 to 15, January to August, Republic to Independence and finally print “ August 15 is celebrated as the Independence Day of India”. 

Read Answer
Accept a String and find the frequency of a word entered by the user in a String.

This Java program accepts a sentence and a word from the user, then calculates the frequency of the specified word in the sentence, counting only exact standalone matches.

Read more
Write a program in Java to accept a String and find the frequency of a word entered by the user in a String. However, the word should not be a part of a String.
Sample Input: The quick brown fox jumps over the lazy dog.
                          Frequency of the word to be searched: the
Sample Output: 2

Read Answer
Accept a string (containing three words) and display the new string after reversing each character of the word.

This Java program takes a string of exactly three words, reverses each word individually, and outputs the result. It demonstrates the use of basic string manipulation techniques using Java's StringBuilder and array handling methods.

Read more
Write a program in Java to accept a string (containing three words) and display the new string after reversing each character of the word.
Sample Input: India is my country
Sample Output: aidnl si ym yrtnuoc

Read Answer
Accept a string (containing three words) and display the same in reverse order.

This Java program accepts a user-inputted string containing exactly three words and outputs those words in reverse order, demonstrating basic string manipulation techniques.

Read more
Write a program in Java to accept a string (containing three words) and display the same in reverse order.
Sample Input: The computer is fun
Sample Output: Fun is a computer

Read Answer
Accept a name (containing three words) and display the initials along with the surname.

This Java program allows users to input a name consisting of three words, from which it extracts the initials of the first two words and combines them with the surname. It demonstrates basic string manipulation techniques in Java, making it an excellent exercise for beginners.

Read more
Write a program in Java to accept a name (containing three words) and display the initials along with the surname.
Sample Input: Subhash Chandra Bose
Sample Output: S. C. Bose 
Read Answer
Accept a string and display the number of upper case, number of lower case, number of special characters and number of digits present in the string.

This Java program analyzes a user-inputted string to count and display the number of uppercase characters, lowercase characters, special characters, and digits present in it. It demonstrates basic string manipulation techniques and character classification using Java's built-in methods.

Read more
Write a program in Java to accept a string and display the number of upper case, number of lower case, number of special characters and number of digits present in the string.
Sample Input: Jamshedpur-831005
Sample Output: Number of upper case characters = 1
                             Number of lowercase characters = 9
                             Number of special characters = 1
                             Number of digits = 6 

Read Answer
Write a program in Java to accept a string and find: a) Number of blank spaces in the string, b) Number of words in the string, c) Number of characters present in the string

Here’s a Java program that accepts a string and finds the number of blank spaces, the number of words, and the total number of characters in the string. Additionally, I've included meta tags and a short description.

Read more
   Write a program in Java to accept a string and find:
a)      Number of blank spaces in the string
b)      Number of words in the string
c)      Number of characters present in the string

Read Answer
Accept a string change the case of each character of the string and display the new string

Here’s a Java program that accepts a string, changes the case of each character, and displays the new string. Below the program, I’ve included relevant meta tags and a short description.

Read more
Write a program in Java to accept a string change the case of each character of the string and display the new string
 Sample Input: WelComE To School
Sample Output: wELcOMe to sCHOOL

Read Answer
Write a program to accept a String in lowercase and replace ‘e’ with ‘*’ in the given String.

This Java program allows the user to input a lowercase string and replaces every instance of the letter 'e' with an asterisk ('*'). It effectively demonstrates basic string manipulation techniques in Java, providing a practical example for beginners.

Read more
Write a program to accept a String in lowercase and replace ‘e’ with ‘*’ in the given String. Display the new String.
Sample Input: Computer science
Sample Output: Comput*r sci*nc*
Read Answer