OneCompiler

PRINT THE STRINGS WHICH STARTS WITH AN UPPER CASE LETTER

280

Define a class to accept and store 10 strings into the array and print the strings which starts with an uppercase letter.

import java.util.*;

public class upperCase {
public static void main(String[] args) {
char ch=' ';
Scanner sc = new Scanner(System.in);
String a[ ]= new String[10];
System.out.println("ENTER TEN STRINGS : " );
for ( int i = 0 ; i<10; i++)
a[i] = sc.next();
System.out.println("PRINTING THE STRINGS WHICH STARTS WITH AN UPPER CASE LETTER : ");
for(int i=0; i<10; i++)
{
ch = a[i].charAt(0);
if(ch>='A'&& ch<='Z')
System.out.println(a[i] + " STARTS WITH AN UPPER CASE LETTER");
}
}
}

FOR CODE ,
CLICK : https://onecompiler.com/java/3xywmg4v8 (TO FIND OUTPUT)