Find the length of the string and convert in lower / upper case in Java

package javabasics;

public class StringUsage 

	public static void main(String[] args) 
		String S1 = "India is my country";
		String S2 = "USA is my country";
		//Find the length of string S1.
		System.out.println("Length of S1 : --- "+S1.length()+"\n");
		//Find the length of string S2.
		System.out.println("Length of S2 : --- "+S2.length()+"\n");
		//Converting whole string S1 in lower case
		System.out.println("String S1 in lower case : --- "+S1.toLowerCase()+"\n");
		//Converting whole string S2 in upper case
		System.out.println("String S2 in upper case : --- "+S2.toUpperCase()+"\n");				




Length of S1 : --- 19

Length of S2 : --- 17

String S1 in lower case : --- india is my country

String S2 in upper case : --- USA IS MY COUNTRY


Leave a Reply

Your email address will not be published. Required fields are marked *