๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ ref_string_substring.asp
Java String substring() Method
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Practice Problems Java Server Java Syllabus Java Study Plan Java Interview Q&A ... The substring() method returns a substring from the string.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ substring-in-java
Java String substring() Method - GeeksforGeeks
April 11, 2025 - In Java, the substring() method of the String class returns a substring from the given string. This method is most useful when you deal with text manipulation, parsing, or data extraction.
Discussions

I think I wasted my damn time on W3Schools.
If it helps you then it wasn't a waste of time. I'm a full time full stack dev and find that W3 often puts things into layman's terms that I may otherwise be having a hard time understanding More on reddit.com
๐ŸŒ r/learnprogramming
126
161
February 11, 2024
Am I the only person who thinks W3schools isn't a great resource to learn?
I think people who know the basics and go to w3 to refresh stuff recommend it but they themselves didn't learn it there. More on reddit.com
๐ŸŒ r/learnprogramming
75
98
March 13, 2022
๐ŸŒ
W3Resource
w3resource.com โ€บ java-tutorial โ€บ string โ€บ string_substring.php
Java String: substring Method - w3resource
String new_str = str.substring(10, 26); System.out.println(); // Display the two strings for comparison. System.out.println("old = " + str); System.out.println("new = " + new_str); System.out.println(); } } ... IndexOutOfBoundsException - if beginIndex is negative or larger than the length of this String object. ... Exception in thread "main" java.lang.StringIndexOutOfBo undsException: String index out of range: -10 at java.lang.String.substring(String.java:1960) at Exercise.main(Exercise.java:9)
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ java_strings.asp
Java Strings
Java counts positions from zero. 0 is the first position in a string, 1 is the second, 2 is the third ...
๐ŸŒ
W3Schools
w3schools.com โ€บ jsref โ€บ jsref_substring.asp
JavaScript String substring() Method
The substring() method extracts characters, between two indices (positions), from a string, and returns the substring. The substring() method extracts characters from start to end (exclusive).
๐ŸŒ
Codecademy
codecademy.com โ€บ docs โ€บ java โ€บ strings โ€บ .substring()
Java | Strings | .substring() | Codecademy
April 28, 2025 - Returns a part of the string specified through a starting index and an optional ending index.
๐ŸŒ
Programiz
programiz.com โ€บ java-programming โ€บ library โ€บ string โ€บ substring
Java String substring()
System.out.println(str1.substring(0, ... substring() method returns a substring from the given string. The substring begins with the character at the startIndex and extends to the character at index endIndex - 1...
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ java โ€บ java_string_substring.htm
Java - String substring() Method
This method has two variants and returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string or up to endIndex 1, if the second argument is given.
Find elsewhere
๐ŸŒ
DigitalOcean
digitalocean.com โ€บ community โ€บ tutorials โ€บ java-string-substring
Master Java Substring Method: Examples, Syntax, and Use Cases | DigitalOcean
Learn how to use the Java substring method. Explore syntax, practical examples, and common errors to handle substrings effectively.
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2013 โ€บ 12 โ€บ java-string-substring-method-example
Java String substring() Method with examples
As its explained above the example , โ€œchaitanyaโ€.substring(2,5) and the result is โ€œa(2)i(3)t(4)โ€, so the fifth character isnโ€™t taken ? ... also count space ,secondly 20 end at โ€œsโ€,so java show less one character.so result is jump. Example: abc 012 (0,1) show just a exclusive end point.
๐ŸŒ
Home and Learn
homeandlearn.co.uk โ€บ java โ€บ substring.html
java for complete beginners - substring
To get the first characters, we had a 0 and a 2 between the round brackets of substring. You might think that to get the "Ga" of "Gates" that we could just do this: ... We still want two characters, after all. Only this time, the 5 would tell Java to start from the "G" of "Gates". (The first position in a string is position 0 not position 1.) So, start at position 5 in the string and grab 2 characters.
๐ŸŒ
Hero Vired
herovired.com โ€บ learning-hub โ€บ blogs โ€บ java-substring
Substring in Java: How to Use the Function [Code Examples]
Return Value: Specified substring. Substring is the string manipulation function, which manipulates string data types (such as BLOB, BIT, and CHARACTER). In addition, it extracts characters from one string and creates another.
๐ŸŒ
Igmguru
igmguru.com โ€บ home โ€บ blog โ€บ java โ€บ substring in java
Java String substring() Method: A Complete Guide | igmGuru
3 weeks ago - The following are the syntaxes ... ways: This version returns the substring starting from beginIndex up to the end of the string. The character at beginIndex is included in the result. This version returns the substring from beginIndex to endIndex - 1....
๐ŸŒ
Javatpoint
javatpoint.com โ€บ java-string-substring
Java String substring()
Java String substring() method with method signature and examples of concat, compare, touppercase, tolowercase, trim, length, equals, split, string substring in java etc.
๐ŸŒ
Great Learning
mygreatlearning.com โ€บ blog โ€บ it/software development โ€บ java substring: an in-depth guide
Java Substring: An In-depth Guide
September 3, 2024 - If an end index is provided, the ... of the string. Remember, Java employs zero-based indexing, meaning the first character of a string is at index 0, not 1....
๐ŸŒ
Software Testing Help
softwaretestinghelp.com โ€บ home โ€บ java โ€บ java substring() method โ€“ tutorial with examples
Java substring() Method - Tutorial With Examples
April 1, 2025 - This tutorial will cover Java substring method. We will take a look at the syntax, brief introduction, examples & some useful concepts about Java substring.
๐ŸŒ
TechVidvan
techvidvan.com โ€บ tutorials โ€บ java-string-substring
Java String substring() - TechVidvan
December 2, 2025 - A portion of a string is returned ... is inclusive, and endIndex is exclusive. For example, the initial index begins at 0 while the end index begins at 1....
๐ŸŒ
How to do in Java
howtodoinjava.com โ€บ home โ€บ string โ€บ java string substring()
Java String substring() with Examples - HowToDoInJava
January 10, 2023 - Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { //invalid index str.substring(-1); }); Assertions.assertThrows(IndexOutOfBoundsException.class, () -> { //begin index > end index str.substring(6, 4); }); In this short Java tutorial, we learned to get the substring of a specified string using the begin and end indices.
๐ŸŒ
The Knowledge Academy
theknowledgeacademy.com โ€บ blog โ€บ substring-java
Substring in Java: Everything You Need to Know
March 27, 2023 - In this blog, we will cover everything you need to know about Substring in Java. We will explain what a substring is, how to use the substring () method, what are the parameters and return values of the method, and how to handle exceptions and errors.
๐ŸŒ
Upgrad
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ substring in java
Substring in Java โ€“ Syntax, Examples & Usage Explained
May 14, 2025 - It helps you manipulate text by extracting specific parts of strings. By understanding how it works, its syntax, and common use cases, you can avoid common pitfalls like index errors and use it more effectively in your Java programs.