InterviewSolution
Saved Bookmarks
| 1. |
Q6. WAP to accept a string from the user and display the number of characters in it. |
|
Answer» tion:JAVApublic 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) != ' ') |
|