write a program in java to accept a word and display the ascii of each character
Answers
Answered by
11
It's only a snippet.
private int getAsciiValue(char ch){
return (int)ch;
}
And in main method, pass the characters as parameter to this method. Like,
String word = "Hello";
for(int i = 0; i < word.length(); i++){
char ch = word.charAt(i);
ob.getAsciiValue(ch);
}
private int getAsciiValue(char ch){
return (int)ch;
}
And in main method, pass the characters as parameter to this method. Like,
String word = "Hello";
for(int i = 0; i < word.length(); i++){
char ch = word.charAt(i);
ob.getAsciiValue(ch);
}
Similar questions