Skip to content

Instantly share code, notes, and snippets.

View gauravkukade's full-sized avatar

Gaurav Kukade gauravkukade

View GitHub Profile
@gauravkukade
gauravkukade / UseInternMethod.java
Created August 25, 2019 11:28
A java program to use an 'intern()' method of the String class. 'intern()' method returns the canonical representation of the string. Visit the detailed article about Java String pool and 'intern()' method https://coderolls.com/java-string-pool-and-intern-method
/**
* 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) {
@gauravkukade
gauravkukade / StringReferenceCompare.java
Created August 25, 2019 11:33
A java program to compare the reference of the strings. We use '==' operator to check the reference equality. Visit the detailed article about Java String pool and 'intern()' method https://coderolls.com/java-string-pool-and-intern-method
/**
* 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 {
@gauravkukade
gauravkukade / SubstringExample.java
Last active October 15, 2019 12:21
A Java program to explain the substring() method. This example is used in a blog at https://coderolls.com/java-substring-method
/**
* A Java program to explain the substring() method.
*
* @author Gaurav Kukade at coderolls.com
*
*/
public class SubstringExample {
public static void main(String[] args) {
@gauravkukade
gauravkukade / SubstringExampleWithBothIndex.java
Created October 15, 2019 07:04
A Java program to explain the substring method, which accepts both parameter 'beginIndex' and 'endIndex'. This example is used in a blog a https://coderolls.com/java-substring-method
/**
* A Java program to explain the substring method,
* which accepts both parameter 'beginIndex' and 'endIndex'.
*
*
* @author Gaurav Kukade at coderolls.com
*
*/
public class SubstringExampleWithBothIndex {
@gauravkukade
gauravkukade / CompareUsingEqualsOutput
Created December 21, 2019 04:04
Output of the java program to compare strings using equals https://coderolls.com/compare-strings-in-java/
Comparing strings using equals() and equalsIgnoreCase() method
firstString.equals(secondString) : false
firstString.equals(thirdString) : true
firstString.equalsIgnoreCase(fourthString) : true
@gauravkukade
gauravkukade / CompareUsingEqualsToOperatorOutput
Created December 21, 2019 04:09
The output of the Java Program to compare strings using == operator https://coderolls.com/compare-strings-in-java/
Comparing strings using == operator
firstString == secondString : false
firstString == thirdString : true
firstString == fourthString : false
@gauravkukade
gauravkukade / CompareUsingcompareToOutput
Created December 21, 2019 04:13
The output of the Java program to compare strings using compareTo() and compareToIgnoreCase() method. https://coderolls.com/compare-strings-in-java/
Comparing strings using compareTo() and compareToIgnoreCase() method
firstString.compareTo(secondString) : 7
firstString.compareTo(thirdString) : -9
secondString.compareToIgnoreCase(fourthString) : 0
@gauravkukade
gauravkukade / equals
Created December 21, 2019 04:16
equals() method of the String class in Java https://coderolls.com/compare-strings-in-java/
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
@gauravkukade
gauravkukade / init.git
Created December 30, 2019 05:24
This is the gist for 'git init' command. See full article at https://coderolls.com/basic-git-commads/
HP@Gaurav MINGW64 /e/example
$ git init
Initialized empty Git repository in E:/example/.git/
HP@Gaurav MINGW64 /e/example (master)
$
@gauravkukade
gauravkukade / git-clone.git
Created December 30, 2019 05:31
Cloning the remote git repository. See full article at https://coderolls.com/basic-git-commads/
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