//please save this code as SubString.java or download the given file and compile it with " javac SubString.java " //After successful compilation run this with " java SubString " at CMD // Make sure you have java already //installed in your system CODE : : import java.util.*; class SubString { public static void main(String m[]) { Scanner in=new Scanner(System.in); String s=new String(); System.out.println("Enter a String :"); s=in.next(); int l=s.length(); System.out.println("Length of the string "+s+" is "+l); System.out.println("Your sub String is:"+s.substring(l/2)); } } OUTPUT : :
Your comment will be posted after it is approved.
Leave a Reply. |
Hello friends, i am a CSE student and i am going to upload all the programs of various language which might be in your collage practical list or might help you in performing your practicals in lab. Archives
August 2015
Categories |