Write a program to input a character. Convert the character into its opposite case. Program should continue as long as the user wants.

import java.util.*;
class alphabet
{
static Scanner in=new Scanner(System.in);
public static void main()
{
char c=’ ‘;
do
{
System.out.println(“Enter a character”);
String s=in.nextLine();
c=s.charAt(0);
if(Character.isLetter(c))
{
System.out.println(“Entered character =”+s);
if(Character.isLowerCase(c))
System.out.println(“Output = “+(Character.toUpperCase(c)));

if(Character.isUpperCase(c))
System.out.println(“Output = “+(Character.toLowerCase(c)));
}
else
System.out.println(“Input has a number or special character,program terminated”);
}while(Character.isLetter(c));
}
}

In this post i have shared a java program which is mostly asked by students of computer science.

THANK YOU FOR VISITING OUR BLOG.For more related posts and anime,programing,gaming post please regularly check our blog.

THANK YOU!!!!!!!!!!!!

Lavi Thakur

Recent Posts

How to make money as a Beginner Coder in 2025

Making money as a coder in 2025 is not much of a big or tough…

8 months ago

Lloyds Technology Centre : A Concise Guide

Lloyds Technology Centre, A tech and data company located in Hyderabad, India. They are  part of…

9 months ago

How to Increase Height at Any Age

How to Increase Height at Any Age Rise Above: How to Increase Height at Any…

10 months ago

The Hidden Beauty of Karrukha Wood: A Rare Masterpiece from Nature

In the fast-paced digital world, we often forget the timeless beauty that nature offers. Today,…

10 months ago

Top 10 Deadliest Kicks in Martial Arts [2024]

Top 10 Deadliest Kicks in Martial Arts: Master the Art of Knockouts Martial arts is…

11 months ago

How to Optimize Battery Life of Your Smartphone

How to Optimize Battery Life of Your Smartphone: Tips and Tricks for Prolonging Battery Health…

11 months ago