我无法完成这个模式的逻辑,我已经尝试了每一种if-else语句
这是我正在执行的代码:
import java.util.Scanner;
public class String_pattern_01 {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
System.out.println("Enter the character in continuation to get the pattern");
String s=sc.next();
int d=s.length();
String s2[]=s.split("");
for(int i=0;i<=s.length();i++)
{
String x= s.substring(i, d);
if(i>=1&i<d)
{
for(i=1;i<d;i++)
{String y=x+x.substring(0,i-1);
System.out.println(y);}
}
else
{
System.out.println(x);
}
}
}
}
https://stackoverflow.com/questions/56995113
复制相似问题