Skip to content

Instantly share code, notes, and snippets.

View techindepth's full-sized avatar
👋

ANISH ANTONY techindepth

👋
View GitHub Profile
public native int hashCode();
class Contact {
private String name;
private String phone;
public Contact(String name, String phone) {
this.name = name;
this.phone = phone;
}
public boolean equals(Object contact) {
Contact anotherContact = (Contact)contact;
class Contact {
private String name;
private String phone;
public Contact(String name, String phone) {
this.name = name;
this.phone = phone;
}
@Override
public boolean equals(Object contact) {
public boolean equals(Object obj) {
return (this == obj);
}
class Contact {
private String name;
private String phone;
public Contact(String name, String phone) {
this.name = name;
this.phone = phone;
}
}
public boolean equals(Object anObject) {
if (this == anObject) {
return true;
}
if (anObject instanceof String) {
String anotherString = (String)anObject;
int n = value.length;
if (n == anotherString.value.length) {
char v1[] = value;
public class Test {
public static void main(String[] args) {
String s1 = new String("Anish");
String s2= new String("Anish");
System.out.println(s1.equals(s2));
}
}
public class Test {
public static void main(String[] args) {
int x = 4;
StringBuffer sb = new StringBuffer("..fedcba");
sb.delete(3, 6);
sb.insert(3, "az");
if (sb.length() > 6)
x = sb.indexOf("b");
sb.delete((x - 3), (x - 2));
System.out.println(sb);
public class Test {
public static void main(String[] args) {
String s = "-";
Integer x = 343;
long L343 = 343L;
if (x.equals(L343))
s += ".e1 ";
if (x.equals(343))
s += ".e2 ";
Short s1 = (short) ((new Short((short) 343)) / (new Short((short) 49)));
public class Test {
public static void main(String[] args) {
Long xL = new Long(456L);
long x1 = Long.valueOf("123");
Long x2 = Long.valueOf("123");
long x3 = xL.longValue();
Long x4 = xL.longValue();
Long x5 = Long.parseLong("456");
long x6 = Long.parseLong("123");
}