Merge String Characters Program in Java

Define a class to accept two strings of same length and form a new word in such a way that, the first character of the first word is followed by the first character of the second word and so on. [10] Example: Input string 1-BALL Input String 2- WORD OUTPUT: BWAOLRLD import java.util.Scanner; public class […]

Name with A Program in Java

Define a class to declare an array to accept and store ten words. Display only those words which begin with the letter ‘A’ or ‘a’ and also end with the letter ‘A’ or ‘a’ [10] EXAMPLE Input: Hari, Anita. Akash, Amrita, Alina, Devi, Rishab, Jolin, Farha, AMITHA Output: Anita Amrita Alina AMITHA Farha import java.util.Scanner; […]

Reversed Case of Char Array Program in Java

Define a class to accept a string, and print the characters with the uppercase and lowercase reversed, but all the other characters should remain the same as before [10] EXAMPLE: INPUT: WelCoMe_2022 OUTPUT: wELcOmE_2022 import java.util.Scanner; public class ReversedCase { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String st; String newSt […]

Product and Square of Array Program in Java

Define a class to declare an array of size twenty of double datatype, accept the elements into the array and perform the following: • Calculate and print the product of all the elements. • Print the square of each element of the array. import java.util.Scanner; public class ProductOfArray { public static void main(String[] args) { […]

Find Highest and Lowest ASCII value Program in Java

Define a class to declare a character array of size ten, accept the characters into the array and display the characters with highest and lowest ASCII (American Standard Code for Information Interchange) value. [10] EXAMPLE INPUT ‘R’, ‘2’,’9′,’A’,’N’,’p’,’m’, ‘Q’,’F’ OUTPUT: Character with highest ASCII value = z Character with lowest ASCII value =A import java.util.Scanner; […]

Bubble Sort in String Program in Java

import java.util.Scanner; public class BubbleSortString { public static void main(String[] args) { String temp; String str[] = new String[10]; Scanner sc = new Scanner(System.in); for (int i = 0; i < 10; i++) { System.out.print("Enter the string ar[" + i + "]:"); str[i] = sc.nextLine(); } for (int j = 0; j < str.length; j++) […]

Palindrome String

import java.util.Scanner; public class PalindromeString { public static void main(String[] args) { String st,revSt=””; int l; Scanner sc=new Scanner(System.in); System.out.print(“Enter String:”); st=sc.nextLine(); l=st.length(); for (int i = l-1; i >= 0; i–) { char ch; ch=st.charAt(i); revSt=revSt+ch; } if(st.equals(revSt)) { System.out.println(“Palindrome String”); } else { System.out.println(“Not Palindrome String”); } } } Output: Enter String:asdsa Palindrome […]

1 2 3 34