Tuesday, 14 March 2017

Java Program on String Manipulations




Write a JAVA program to print following output?

Input Format:

tech prompt

Output Format:

TECH PROMPT
Tech Prompt

Program:

import java.io.*;
import java.lang.*;
public class Test{
   public static void main(String args[ ]){
      String inp = "tech prompt";
      String a[ ] = inp.split(" ");
      System.out.println(inp.toUpperCase( ));
      for(int i = 0;i <  a.length;i++){
            String str = a[i];
            System.out.print((str.substring(0,1).toUpperCase( ) + str.substring(1, str.length( )));
      }
   }
}












0 comments:

Post a Comment