Posts

Showing posts from September 17, 2025

21 to 30 String Programs

100 Java String Programming Questions 100 Java String Programming Questions 21 to 30 Java Programs 21//Write a program to compare two strings lexicographically. Show Answer class lexicographically { public static void main(String[] args) { String str1="apple"; String str2="Apple"; int comparedValue=(str1.compareTo(str2)); if(comparedValue>0){ System.out.println(str1+ " will comes after "+str2); } else if(comparedValue 22//Write a program to concatenate two strings. Show Answer public class StringConcatenation { public static void main(String[] args) { String str1 = "Hello"; String str2 = "World"; String result1 = str1 + " " + str2; System.out.println("Concatenated string: " + result1); String ...

Problem 50:(Round 2 Java Preparation)

Image
Problem of the Day: You want to sort words lexicographically without using inbuilt functions like Arrays.sort(). Input:{"zebra", "apple", "mango", "ball", "cat", "dog", "elephant", "fish", "ant", "bat"}; Output:ant apple ball bat cat dog elephant fish mango zebra 1. Input: nums1 = [1, 3, 5, 7, 9] nums2 = [2, 3, 5, 6, 8, 9] Output: [1, 2, 3, 5, 6, 7, 8, 9] 2. Input: nums1 = [2, 4, 6, 8] nums2 = [1, 3, 5, 7, 9] Output: [1, 2, 3,4, 5, 6, 7, 8, 9] .snippet-thumbnail img { max-width: 50px; height: auto; object-fit: cover; }

Problem 49:(Round 2 Java Preparation)

Image
Problem of the Day: You want to sort words lexicographically without using inbuilt functions like Arrays.sort(). Input:{"zebra", "apple", "mango", "ball", "cat", "dog", "elephant", "fish", "ant", "bat"}; Output:ant apple ball bat cat dog elephant fish mango zebra .snippet-thumbnail img { max-width: 50px; height: auto; object-fit: cover; }