Java, .NET, PHP, PYTHON, ANGULAR, .NET, ML, Data Scince, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

Program to Reverse String :-

class StringRev
{
public static void main(String args[])
{
    String s = "welcome in shiva concept solution";
    for(int i=s.length()-1;i>=0;i--)
    {
          System.out.print(s.charAt(i));

    }


}

}


Program to replace each correct or String to Consecutive Char?



class StringRev
{
public static void main(String args[])
{
    String s = "welcome in shiva concept solution ";
    String arr[] = new String[6];
     int j=0;
     String s1="";
     for(int i=0;i<s.length();i++)
     {
        if(s.charAt(i)!=' ')
          s1+=s.charAt(i);
        else
        {
         arr[j]=s1;
         j++;
         s1="";
        }
         
         
     }
     for(int i=0;i<5;i++)
     {
        System.out.println(arr[i]);
        char arr2[] = new char[arr[i].length()];
       
        for(int k=0;k<arr2.length;k++)
         {
        int asc=arr[i].charAt(k);
        arr2[i]=(char)(asc+1);
        System.out.print(arr2[i]);
        }
        System.out.println();
     }
 
    System.out.println(s);



}

}

Post a Comment

If you have any doubt in programming or join online classes then you can contact us by comment .

Previous Post Next Post