Answer to Question #62246 in Java | JSP | JSF for Areeb

Question #62246
In java i know who to get letters from a string. String first = firstName.substring(0,3); This will her first three letters. But how do i get letters starting from 2nd letter to end assuming there is a 2nd letter and onward. Some thing like this String first = firstName.substring(2,end); but the end should be replaced with what?? Thanks
1
Expert's answer
2016-09-30T14:34:03-0400
public class Main {
public static void main(String[] args) {
String s = "Test string";

String sub = s.substring(2, s.length());

System.out.println(sub);
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS