/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package substrWord; import java.io.BufferedReader; import java.io.InputStreamReader; /** * * @author Student */ public class java { /** * @param args the command line arguments */ public static void main(String[] args) { String strLine=""; int i; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter Index of String where you want it to stop:"); try{ strLine=br.readLine(); } catch(Exception e){ System.out.println("Error:"+e.toString()); } i = Integer.parseInt(strLine); String str="Yellow Fever"; // for (int i=1; i<=str.length(); i++){ System.out.println(str.substring(0,i)); // System.out.println(str.length()); } }