PROGRAM FOR STRING MANIPULATION IN JAVA

import java.util.*;
import java.lang.*;

class JavaString
{
    public static void main(String [] args)
    {
     char[] ch={'c','o','m','p','u','t','e','r'};
     char[] it={'s','c','i','e','n','c','e'};

     String t= new String(it);
     String s=new String(ch);

     String r;
     String q;
     char a;
 
     System.out.println("Given string is    "+ s);
   
     System.out.println("The Length of the String is  "+s.length());
   
     System.out.println("Given String in upper case  "+s.toUpperCase());   
   
     a=s.charAt(5);
     System.out.println("Character at the 5 position is "+a);
 
     r=String.join("&",s,t);
     System.out.println("Output of String Join Method is   "+r);
   
     q=s.concat(t);
     System.out.println("concatenation of the string is   "+q);
         
     }
}

SAMPLE OUTPUT:

No comments:

Post a Comment