All subsets of a String in java using recursion
If I have understood correctly, you're aiming for all subset of a String.
Through  your code for String = "ABC"; //Result is -- &gt;  A AB ABC AC B BC C

However, for 

String = "ABB";
// Result is --&gt; A AB ABB AB B BB B (You see AB twice as well as letter B).


So to make it more clear for unique subsets, added a set implementation. 

TreeSet (extra sorted feature over hash), as below : (using same recursion)

public class Test {

 public static void allSet(String s, String t, Set&lt;String&gt; set) {
     // System.out.print(t + " ");   will print later.
      if(!"".equalsIgnoreCase(t))
      set.add(t);
      if (s.length() &gt; 0) {
          for (int i = 0; i &lt; s.length(); i++) {
              allSet(s.substring(i + 1, s.length()), t + s.charAt(i),set);
          }
      }
  }
public static void main(String args[]) {
    String a = "ABB";
    String t = "";
    Set&lt;String&gt; set = new TreeSet&lt;String&gt;();
    allSet(a, t, set);
    System.out.println(set.toString());
   }



// Now, result --&gt; [A, AB, ABB, B, BB]