In this Problem we will create a sub string from a string. The user will give an index number of a string and the program make new string from that number.
Source Code
package com.ancodingpoint.ww.w; import java.util.Scanner; public class String_Function { public static void main(String[] args) { Scanner input = new Scanner (System.in); String a = ""; int b = 0; System.out.println(" Enter Your Story Here !..... "); a = input.nextLine(); System.out.println(" Enter the Index Number from where you want to cut and put themin new String "); b = input.nextInt(); System.out.println(" You Press " + b + "and your sub string is below "); System.out.println(a.substring(b)); //System.out.println(a); } }
0 comments:
Post a Comment