substring(int beginIndex, int endIndex) method in JDK 6 and JDK 7 are different. Knowing the difference can help you better use them. For simplicity reasons, in the following substring() 1. What substring() does? The substring(int beginIndex, int endIndex) method returns a string that starts with beginIndex and ends with endIndex-1. String x = "abcdef"; x = x.substring(1,3); System.out.println(x); Output: bc 2. What happens when substring() is called? You may know that because x is immutable, when x is assigned with the result of x.substring(1,3),
Read full article from The substring() Method in JDK 6 and JDK 7
No comments:
Post a Comment