Write a Java program to find all the substring and print them. For example subsrings of "fun" are: "f", "fu", "fun", "u", "un", and "n". Use substring method of String class to find substring

class Exp4_1
{
 public static void main(String[] args) 
 {
  String s = "java";
  for(int i = 0; i < s.length(); i++)
  {
   for(int j = i+1; j <=s.length(); j++)
    System.out.println(s.substring(i,j));
  }
 }
}
/*  OUTPUT!!!
j
ja
jav
java
a
av
ava
v
va
a
*/
Copyright © LetML. Blogger Templates Designed by OddThemes