This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A java program to use an intern() method of the String class. | |
* | |
* intern() method returns the canonical representation of the string. | |
* @author Gaurav Kukade at coderolls.com | |
*/ | |
public class UseInternMethod { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A java program to compare the reference of the strings. | |
* We use '==' operator to check the reference equality. | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ | |
public class StringReferenceCompare { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A Java program to explain the substring() method. | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ | |
public class SubstringExample { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A Java program to explain the substring method, | |
* which accepts both parameter 'beginIndex' and 'endIndex'. | |
* | |
* | |
* @author Gaurav Kukade at coderolls.com | |
* | |
*/ | |
public class SubstringExampleWithBothIndex { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comparing strings using equals() and equalsIgnoreCase() method | |
firstString.equals(secondString) : false | |
firstString.equals(thirdString) : true | |
firstString.equalsIgnoreCase(fourthString) : true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comparing strings using == operator | |
firstString == secondString : false | |
firstString == thirdString : true | |
firstString == fourthString : false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Comparing strings using compareTo() and compareToIgnoreCase() method | |
firstString.compareTo(secondString) : 7 | |
firstString.compareTo(thirdString) : -9 | |
secondString.compareToIgnoreCase(fourthString) : 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean equals(Object anObject) | |
It compare this string with the argument strings and return true if the argument is not null and contains the same character as the specified string. | |
param - | |
another string | |
returns - | |
true - if argument is not null and it contains same characters as the specified string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HP@Gaurav MINGW64 /e/example | |
$ git init | |
Initialized empty Git repository in E:/example/.git/ | |
HP@Gaurav MINGW64 /e/example (master) | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HP@Gaurav MINGW64 /e/directory | |
$ git clone https://github.com/gauravkukade/example.git | |
Cloning into 'example'... | |
remote: Enumerating objects: 16, done. | |
remote: Counting objects: 100% (16/16), done. | |
remote: Compressing objects: 100% (10/10), done. | |
remote: Total 16 (delta 3), reused 7 (delta 2), pack-reused 0 | |
Unpacking objects: 100% (16/16), done. | |
HP@Gaurav MINGW64 /e/directory |