Skip to content

Commit 7a38177

Browse files
committed
feat: Demonstrate usage of Java String substring() method
- Created a simple `Substring` class to showcase the `substring(int beginIndex)` method of the `String` class. - Defined a string variable `name` with the value "Virat Kholi". - Extracted a substring starting from index 5 using `name.substring(5)`, which returns "Kholi". - Printed the resulting substring to demonstrate how the method returns the portion of the string from the specified index to the end. This commit provides a basic example of Java's substring functionality, useful for string manipulation tasks. Signed-off-by: Somesh diwan <[email protected]>
1 parent 76268d2 commit 7a38177

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Section6StringClassPrinting/Engineering Digest ED/src/Substring.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ public static void main(String[] args) {
55
String substring = name.substring(5);
66
System.out.println(substring);
77
}
8-
}
8+
}

0 commit comments

Comments
 (0)