String Handling [All Functions]

 import java.util.Scanner;


public class str

{


public static void main(String Args[])

{  


try 

  String choice,ch2;   

  

  int input;

  

  System.out.println("Enter the name");


  Scanner s1= new Scanner(System.in);

     

  choice = s1.nextLine(); 

 

  System.out.println("Enter another name");   

  

  ch2= s1.nextLine();      

  

  if(choice.isEmpty() || ch2.isEmpty()) 

  { 

  System.out.println("Enter the name...please!");

  }

  

  else 

  {

  

  System.out.println(choice);  

   

  System.out.println("Enter the character position");

 

  input= s1.nextInt();

  

  System.out.println(choice.charAt(input));  

  

  System.out.println(choice.codePointAt(3)); 

  

  System.out.println(choice.codePointBefore(4)); 

  

  if(choice.equals(ch2)) 

  { 

  System.out.println("your entered new string is matched"); 

  

  System.out.println(ch2.toUpperCase()); 

  

  System.out.println(choice.compareToIgnoreCase(ch2));

  } 

  else

  { 

  System.out.println("your entered new string is not matched");  

  

  System.out.println("The concatenated string is"); 

  

  System.out.println(choice.concat(ch2));  

  

  }

  

  }

 

  

  

}


catch(Exception e) 



}


}


}

Comments