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
class A { | |
void simple_Method() | |
{ | |
System.out.println("I am a simple method"); | |
} | |
} | |
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
class A { | |
void simple_Method() { | |
System.out.println("I am a simple method"); | |
} | |
} | |
public class Main { |
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
class A { | |
static void simple_Method() { | |
System.out.println("I am a simple method"); | |
} | |
} | |
public class Main { |
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
class A { | |
public void simple_Method() { | |
System.out.println("I am a simple method"); | |
} | |
} | |
public class Main { |
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
class A { | |
protected void simple_Method() { | |
System.out.println("I am a simple method"); | |
} | |
} | |
public class Main extends A{ |
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 static void main(String[] args) { | |
char char1 = 'a'; | |
char char2 = 'b'; | |
// false as 'a' is not equal to 'b' | |
System.out.println(char1 == char2); | |
} |
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 static void main(String[] args) { | |
char char1 = 'a'; | |
char char2 = 'b'; | |
int comparison = Character.compare(char1, char2); | |
if (comparison==0) { | |
System.out.println("the characters are same"); | |
} | |
else { | |
System.out.println("the characters are different"); |
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 static void main(String[] args) { | |
char char1 = 'a'; | |
char char2 = 'b'; | |
int char1Code = Character.hashCode(char1); | |
int char2Code = Character.hashCode(char2); | |
if (char1Code == char2Code) { | |
System.out.println("the characters are same"); | |
} | |
else { |
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 static void main(String[] args) { | |
Character char1 = new Character('a'); | |
Character char2 = new Character('b'); | |
if (char1.equals(char2) == true) { | |
System.out.println("the characters are same"); | |
} else { | |
System.out.println("the characters are different"); | |
} |
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 static void main(String[] args) { | |
Character char1 = new Character('a'); | |
Character char2 = new Character('b'); | |
if (Character.compare(char1, char2) == 0) { | |
System.out.println("the characters are same"); | |
} else { | |
System.out.println("the characters are different"); | |
} |