Write a Java program to input any string . convert all upper case character into lower case character and lower case character into upper case.
Answers
Answer:
Program:
public class changeCase {
public static void main(String[] args) {
String str1="Great Power";
StringBuffer newStr=new StringBuffer(str1);
for(int i = 0; i < str1. length(); i++) {
//Checks for lower case character.
if(Character. isLowerCase(str1. charAt(i))) {
//Convert it into upper case using toUpperCase() function.
Explanation:
The toUpperCase() method converts a string to upper case letters. Note: The toLowerCase() method converts a string to lower case letters.
Answer:
public class changeCase {
public static void main(String[] args) {
String str1="Great Power";
StringBuffer newStr=new StringBuffer(str1);
for(int i = 0; i < str1. length(); i++) {
//Checks for lower case character.
if(Character. isLowerCase(str1. charAt(i))) {
//Convert it into upper case using to uppercase () function
Explanation:
I hope it helps u. Please follow me