In this BlueJ program, the word BLUEJ will be displayed in different rearranged form like:
BLUEJ
LUEJB
UEJBL
EJBLU
JBLUE
Download eBook on BlueJ
class Jav
{
String s="BLUEJ";
int x,i,j,len;
void show()
{
len=s.length();
for(i=0;i< len;i++)
{
x=i;
for(j=0;j< len;j++)
{
System.out.print(s.charAt(x));
x++;
if(x==len)
x=0;
}
System.out.println();
}
}
public static void main(String args[])
{
Jav ob=new Jav();
ob.show();
}
}
No comments:
Post a Comment