Computer Science, asked by Srijan07, 5 months ago

Write a program in java to input a sentence and count the number of alphabets in
small letters, number of alphabets in capital letters and number of whitespaces and display them. Use Character wrapper class.

Answers

Answered by gurpreetkoki
0

Answer:

public class CountCharacter.

{

public static void main(String[] args) {

String string = "The best of both worlds";

int count = 0;

//Counts each character except space.

for(int i = 0; i < string. length(); i++) {

if(string. charAt(i) != ' ')

Similar questions