InterviewSolution
Saved Bookmarks
| 1. |
Write a program to accept a character from the terminal window and determine whether it is a letter or not. if it is an alphabet, display its opposite case. if it is not an alphabet, display an appropriate message. |
|
Answer» {JAVA} :Import java.util.*;public class Check{SCANNER sc= new Scanner( System.in); public VOID main() {System.out.println(“Enter the characher”);char CH= sc.next().chatAt(0); if(Character.isLetter(ch)) { if(Character.isUpperCase(ch)) System.out.println(ch+" opposite case is "+ Character.toLowerCase(ch)); else System.out.println(ch+ " opposite case is " +Character.toUpperCase(ch)); } else System.out.println(ch+" is not a LETTER"); }} |
|