0% found this document useful (0 votes)
19 views

Sentence Reverse - Jaa

The program takes a sentence as input from the user, finds the first space, and converts the substring before and after the space to uppercase separately and prints them.

Uploaded by

AAsfaw
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Sentence Reverse - Jaa

The program takes a sentence as input from the user, finds the first space, and converts the substring before and after the space to uppercase separately and prints them.

Uploaded by

AAsfaw
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package counting.

array;
import java.util.Scanner;

public class CountingArray {

public static void main(String[] args) {


System.out.println("enter a given sentence");
int m=0;
Scanner obj=new Scanner(System.in);
String n=obj.nextLine();
int l=n.length();
char f=' ';
for(int i=0;i<l;i++){
if(n.charAt(i)==f)
{ m=i;
break;
}}

System.out.println((n.substring(m+1).toUpperCase())+"
"+n.substring(0,m).toUpperCase());

You might also like