JBJashobant Besrainlearnjava.com·Jul 19, 2023 · 1 min readCount the number of consonants in a string.public class Test { public static void main(String[] args) { String str = "Ironman Spiderman Thor BlackWidow Captain-America"; System.out.println("number of consonants in '" + str + "' is : " + consonantsCount(str)); } ...00
JBJashobant Besrainlearnjava.com·Jul 18, 2023 · 1 min readCount the number of vowels in a string.public class Test { public static void main(String[] args) { String str = "Ironman Spiderman Thor BlackWidow Captain-America"; System.out.println("number of vowels in '" + str + "' is : " + vowelsCount(str)); } private ...00
JBJashobant Besrainlearnjava.com·Jul 17, 2023 · 1 min readFind the occurrence of a given character in the string.public class Test { public static void main(String[] args) { String str = "Ironman Spiderman Thor BlackWidow Captain-America"; char c = 'a'; System.out.println( "The occurrence of a " + c + " in string : " + count(str, c...00
JBJashobant Besrainlearnjava.com·Jul 14, 2023 · 1 min readreverse the order of words in a string.import java.util.Iterator; public class Test { public static void main(String[] args) { String str = "Ironman Spiderman Thor BlackWidow Captain-America"; System.out.println(reverseWord(str)); } private static String rev...00
JBJashobant Besrainlearnjava.com·Jul 12, 2023 · 1 min readreverse the order of words in a string using a String array.public class Test { public static void main(String[] args) { String str = "i am jashobant"; System.out.println(reverseWord(str)); } private static String reverseWord(String str) { String result = ""; Str...00