String Question 16

Home / Java Practice Question / String Question 16

String Question 16


WAP to Find all substrings of a string.

Program : 

public class StringPractise {

public static void printSubString(String str){

for(int i=0;i<str.length();i++){
for(int j=i+1;j<str.length();j++){
System.out.println(str.substring(i,j+1));
}
System.out.println();
}
}