Java Program To Convert Character Cases

Java Program To Convert Character Cases

Write Java program to convert character cases

// WAP  to convert a character from upper to lower and lower to upper case

import java.util.Scanner;
public class CharacterCase
    public static void main(String[] args) 
        Scanner sc = new Scanner(;
        // convert in Lower case
        System.out.println("Enter character in upper case :-->");
        char upper =;

        int ascii = upper + 32;
        System.out.println("Lower case of "+upper+" is : "+(char)ascii);

        // convert in Upper case
        System.out.println("Enter character in lower case :-->");
        char lower =;

        ascii = lower - 32;

        System.out.println("Upper case of "+lower+" is : "+(char)ascii);