# Category Archives: Coding Practice

Coding Practice Solutions

## Calculate number & percentage of characters in a String

This is a program to calculate number and percentage of Lowercase letters, uppercase letters, digits and other special characters in a string. Output Uppar Case Percentage: 14.29 Lower Case Percentage: 45.71 Digits Percentage: 8.57 Other Percentage: 31.43

## Program to reverse String and remove some characters

This is the program to reverse a string and remove character from index 4 to index 9 from the reversed string using String Buffer. It uses concepts of string Buffer and String Class’ reverse function.   Output Original String: This is a new String Reverse String: gnirtS wen a si sihT After Deleting: gniren a si sihT After… Read More »

## Find frequency of a character in String without using loop

This is a program to find the number of occurrences of a character in String without using a loop. Approach: We are using replaceAll and length method of Java String Class here to count the number of a particular character in a string.   Output Length Of String:35 Length Of String Without A:31 Occurrence Of A Char… Read More »

## Find sum of elements of Linked List using Iterator

Sum of elements of Linked List using Iterator : In this program, we are inserting elements in a Linked List. And, then traversing the list using an iterator, the goal is to find sum of all the elements of the list.   Output [4.3, 2.2, 3.5, 5.0] [4.3, 2.2, 3.5] Sum Of Numbers:10.0

## Program to print all sub strings of a String

This is a program in Java to print all the sub strings of a input string. Example : The list of all substrings of the string “apple” would be “apple“, “appl“, “pple“, “app“, “ppl“, “ple“, “ap“, “pp“, “pl“, “le“, “a“, “p“, “l“, “e“, “”.