- To convert string into UPPERCASE
User Input: hello World
Output: HELLO WORLD
import java.util.Scanner;
public class StringToUppercase{
public static void main(String []args) {
String s1;
Scanner userInput = new Scanner(System.in);
System.out.print("Enter your string : ");
s1 = userInput.nextLine();
System.out.println("Your UPPERCASE String : "+ s1.toUpperCase());
}
}
Enter your string : Have good day Your UPPERCASE string : HAVE GOOD DAYProgram
You should know first :
Lowercase alphabets : Starts from a (97) to z (122)
Uppercase alphabets : Starts from A (65) to z (90)
Can use java predefined function toUpperCase()
s1.toUpperCase();
s1.toLowerCase();
Concept