public class Type {
public static void main(String[] args) {
String s1 = "abc";
String s2 = "abc";
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
String s3 = "a1";
String s4 = "a2";
System.out.println(s3 == s4);
System.out.println(s3.equals(s4));
Integer i1 = 11;
Integer i2 = 11;
System.out.println(i1 == i2);
System.out.println(i1.equals(i2));
Character c1 = '0';
Character c2 = '0';
System.out.println(c1 == c2);
System.out.println(c1.equals(c2));
Byte b1 = 121;
Byte b2 = 121;
System.out.println(b1 == b2);
System.out.println(c1.equals(c2));
Float f1 = 1.12f;
Float f2 = 1.12f;
System.out.println(f1 == f2);
System.out.println(f1.equals(f2));
Double d1 = 11.2345d;
Double d2 = 11.2345d;
System.out.println(d1 == d2);
System.out.println(d1.equals(d2));
Long l1 = 22L;
Long l2 = 22L;
System.out.println(l1 == l2);
System.out.println(l1.equals(l2));
BigInteger bi1 = new BigInteger("333");
BigInteger bi2 = new BigInteger("333");
System.out.println(bi1 == bi2);
System.out.println(bi1.equals(bi2));
BigDecimal bd1 = new BigDecimal("12.0");
BigDecimal bd2 = new BigDecimal("12.0");
System.out.println(bd1 == bd2);
System.out.println(bd1.equals(bd2));
BigDecimal bd3 = new BigDecimal("3.0");
BigDecimal bd4 = bd1.divide(bd3, RoundingMode.CEILING);
System.out.println(bd4);
BigDecimal bd5 = new BigDecimal("3.30");
BigDecimal bd6 = bd1.divide(bd5, RoundingMode.CEILING);
System.out.println(bd6);
BigDecimal bd7 = new BigDecimal("3.30");
BigDecimal bd8 = bd1.divide(bd7, RoundingMode.FLOOR);
System.out.println(bd8);
BigDecimal bd9 = new BigDecimal("3.30");
BigDecimal bd10 = bd1.divide(bd9, 2, RoundingMode.FLOOR);
System.out.println(bd10);
BigDecimal bd11 = new BigDecimal("3.30");
BigDecimal bd12 = bd1.divide(bd11, 2, RoundingMode.CEILING);
System.out.println(bd12);
BigDecimal bd13 = new BigDecimal("3.30");
BigDecimal bd14 = bd1.divide(bd13, 2, RoundingMode.HALF_UP);
System.out.println(bd14);
BigDecimal bd15 = new BigDecimal(-1);
BigDecimal bd16 = new BigDecimal(1);
System.out.println(bd15.add(bd16));
BigDecimal bd17 = new BigDecimal(-1);
BigDecimal bd18 = new BigDecimal(1);
System.out.println(bd17.multiply(bd18));
BigDecimal bd19 = new BigDecimal(-1);
BigDecimal bd20 = new BigDecimal(1);
System.out.println(bd19.subtract(bd20));
BigDecimal bd21 = new BigDecimal(Integer.MAX_VALUE);
BigDecimal bd22 = new BigDecimal(1);
System.out.println(bd21.subtract(bd22));
BigDecimal bd23 = new BigDecimal(Long.MAX_VALUE);
BigDecimal bd24 = new BigDecimal(1);
System.out.println(bd23.subtract(bd24));
BigDecimal bd25 = new BigDecimal(Long.MAX_VALUE);
BigDecimal bd26 = new BigDecimal(Long.MAX_VALUE);
System.out.println(bd25.subtract(bd26));
BigDecimal bd27 = new BigDecimal(Long.MIN_VALUE);
BigDecimal bd28 = new BigDecimal(Long.MIN_VALUE);
System.out.println(bd27.subtract(bd28));
BigDecimal bd29 = new BigDecimal(Long.MAX_VALUE);
BigDecimal bd30 = new BigDecimal(Long.MAX_VALUE);
System.out.println(bd29.multiply(bd30));
BigDecimal bd31 = new BigDecimal(Long.MIN_VALUE);
BigDecimal bd32 = new BigDecimal(Long.MAX_VALUE);
System.out.println(bd31.subtract(bd32));
User u1 = new User("a");
User u2 = new User("a");
System.out.println(u1 == u2);
System.out.println(u1.equals(u2));
}
}
class User {
private String name;
public User(String name){
this.name = name;
}
public String getName() {
return name;
}
@Override
public boolean equals(Object obj) {
User u = (User)obj;
boolean b = false;
if(u.getName().equals(this.name)){
b=true;
}
return b;
}
}