WAP to accept a string and convert the string to uppercase in java
Answers
Answered by
1
#Shreyansh59
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.
Answered by
0
import java.util.Scanner;
public class ConvertUppercase {
public static void main(String[ ] args) {
System.out.print("Enter a String - ");
System.out.println("Uppercase - "
+ new Scanner(System.in).nextLine( ).toUpperCase( ));
}
}
Similar questions