Skip to content

Instantly share code, notes, and snippets.

@jainmickey
Created September 18, 2012 15:19
Show Gist options
  • Save jainmickey/3743710 to your computer and use it in GitHub Desktop.
Save jainmickey/3743710 to your computer and use it in GitHub Desktop.
Manipulation of strings in Java
/* Use of Strings and substrings */
class StringExample{
public static void main(String args[]){
String str = "Hello, World!"; //String is a inbuilt class which we can use through objects or instance variable
System.out.println("str is :- " + str);
/* substring is a method inside string class to manipulate strings. This will print the string in str from position 7 to 12 */
System.out.println("substring is :- " + str.substring(7, 12));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment