Character
- 20 January
Program to find frequency of characters in a string in java
In this tutorial, we will see simple program to find frequency of characters in a string in java. There are multiple ways to solve this proble. Let’s see one by one. Using counter array Here is the algorithm for the same. Initialize counter array of 256 length Iterate over String and increase count by 1 […]
- 19 January
Java Program to Check Whether a Character is Alphabet or Not
This tutorial provides Java Program to Check Whether a Character is Alphabet or Not. [crayon-67682309ee9fb022406213/] Output: Enter a Character : d d is an alphabet. The ASCII value of lowercase alphabets range from 97 to 122. And, the ASCII value of uppercase alphabets range from 65 to 90. That’s why, we compared variable character between […]
- 19 January
Java Program to check a Character is Vowel or Consonant
In this post, we will see how to check a Character is Vowel or Consonant. You just need to check if character is part of set {a,A,e,E,i,I,o,O,u,U}.If it is part of set then it is Vowel else Consonant. [crayon-67682309eeaa2421033464/] Output: Enter an Alphabet : g g is a Consonant That’s all about Java Program to […]
- 08 May
Java Program to find duplicate Characters in a String
In this post, we will see how to find duplicate Characters in a String. Approach: Create a HashMap and character of String will be inserted as key and its count as value. If Hashamap already contains char,increase its count by 1, else put char in HashMap If value of Char is more than 1, that means it […]
- 04 May
How to convert Char Array to String in java
There are multiple ways to convert Char Array to String in java. Some of them are: Using String class’s constructor (By passing Char array to contructor) Using String class’s valueOf method Using iterating char array Example: [crayon-67682309eed3b524682123/] When you run above program, you will get below output [crayon-67682309eed3f722358717/] Other String Programs are : How to […]
- 04 May
How to convert String to Char Array in java
Java String’s toCharArray() method can be used to convert String to char Array in java. It is simplest method to convert String to char Array. Example: [crayon-67682309eeded204420815/] When you run above program, you will get below output: [crayon-67682309eedf1374017671/] Other String Programs are : String : How to reverse String in java How to check if […]