Sunday, 27 November 2016

How To Reverse An String Without Using Array

Hii Friend,
Today We are going to take an example of "How To Reverse An String Without Using Array and objects". Genarally you will find lots of Program that will show using Array and other objects, but if you use array and objects that will take much memory spaces. So Here We will see without creating different objects or without using array.



class ReverseStringWithoutCreatingAnyObject
{



static StringBuffer s=new StringBuffer("sunny is this");
public static void main(String[] args)
{
int i=0;
while(i<s.length()){

System.out.println(s);
i++;
}

}
}


In This Program you will see there is no extra objects we have created and we have not taken any array. so here we can save memory and time.

Thanks (SmartiesGeeks)

No comments:

Post a Comment

Make Top Rank Blog