How to make a Triangle pattern of words using Given String
SOURCE : StringTriangleWords.javaimport java.util.StringTokenizer;public class StringTriangleWords { public static void main(String[] args) { String s1 = "this is the country which is my first love "; StringBuffer sb = new StringBuffer(); StringTokenizer st = new StringTokenizer(s1); while (st.hasMoreTokens()) { System.out.println(sb.append(st.nextToken() + " ")); } }}INPUTString s1 = "this is the country which is my first love "OUTPUT
this this is this is the this is the country this is the country which this is the country which is this is the country which is my this is the country which is my first this is the country which is my first love

0 comments :
Post a Comment