Try something like this based on the logic which Salil suggested. (code is not tested)
import java.util.Scanner;
class SubstringsOfAString
{
public static void main(String args[])
{
String string, sub, sub1;
int i, c, length;
Scanner in = new Scanner(System.in);
System.out.println("Enter a string to print it's all substrings");
string = in.nextLine();
length = string.length();
System.out.println("Substrings of \""+string+"\" are :");
for( c = 0 ; c < length ; c++ )
{
if (c==0)
{
sub = string.substring(c+1, length-1);
}
else // we need two string 0 to index-1 and index+1 to end then concat
{
sub = string.substring(0, c -1);
sub1 = string.substring(c+1, length-1);
System.out.println(sub.concat(sub1));
}
}
}
}