Monday , December 18 2017
Home / Blue J / Java program for string in circular fashion.

Java program for string in circular fashion.

Write a program to input any string and output it in the following format: 

hello
elloh
llohe
lohel
ohell
 
class circularstring
{
public static void main(String args[])
{
String str=args[0],p,s="";
int i,j;
for(i=0;i<str.length();i++)
{
p=str.substring(i,l);
s=str.substring(0,i);
System.out.println(p+s);
}
}
}
OUTPUT:
 
hello
elloh
llohe
lohel
ohell
Tags: java program for circular string, bluej program for circulating the string in each line, program for string in round robin fashion.
 
Also See:   Java Program to check for a Magic Number

Check Also

Java program to implement polymorphism

Java program to implement polymorphism: Polymorphism is a technique in java with which you can ...

Leave a Reply

Your email address will not be published. Required fields are marked *