Java substring method

Java substring method maximum use in advance and basic level java programs. In my website creation many time use substring() function to find proper data from string.

 

2 types of substring() method available in java string program

substring(int)

In this method, output will be start index(int) to entire left string

substring(int,int)

In this method, output will be startindex(int) to endindex(int) – Part of String

 

Let’s see example on java substring method

 

class str7

{

                public static void main(String args[])

                {

                                String str = “Welcome in Java String”;

 

                                System.out.println(str.substring(11));   

// Output -> Java String

                                System.out.println(str.substring(11,15));

// Output -> Java

                }

}

 

Output:

Java String

Java

 

Video on substring method


[sbscrbr_form]

If you have any query on blog example, you can directly comment us or subscribe our website


Earn Money Online

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

274total visits,5visits today


mayank

Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.

Website

Link back if you want.

Enter Captcha Here :*

Reload Image

EmailEmail
PrintPrint