11/7=1 [Integer division][Yields wa]
11.0/7 = 1.5714285714285714 [11/7.0 or 11.0/7.0]
a. divide by zero [Arithmetic Exception]
b. sqrt(-ve or < 0) [NaN]
c. Array indexing (-ve) [Array Index Out Of Bounds Exception]
a. sqrt(abcd) instead of sqrt(ab)sqrt(cd)
b. intermediate value overflow
c. double is reliable for upto 15 digits, long 18 digits, int 9 digits.
d. exp, log, log10, sqrt, cbrt math functions are returns values in double
e. use BigInteger for big number calculation
// long MICROS_PER_DAY = 24L * 60 * 60 * 1000 * 1000;
9. The lowercase letter el (l) and the digit 1 are nearly identical, so don’t use el (l) as a variable name
double a = 2; // 2.0
double b = 2.0; // 2.0
BigDecimal c = BigDecimal.valueOf(2); // 2
BigDecimal d = BigDecimal.valueOf(2.0); // 2.0
BigDecimal.equals and BigDecimal.compareTo() == 0 give different results. equals considers two BigDecimal objects equal only if they are equal in value and scale (thus 2.0 is not equal to 2.00 when compared by this method). Two BigDecimal objects that are equal in value but have a different scale (like 2.0 and 2.00) are considered equal by compareTo.
// New Line Scheme for AC
System.out.println();
writer.println(); // PrintWriter writer;
writer.printf("\n"); // PrintWriter writer;
writer.newLine(); // BufferedWriter writer;
writer.write("\n"); // BufferedWriter writer;
// New Line Scheme for WA
System.out.println("\n");
writer.write("\n\r"); // BufferedWriter writer;
writer.write("\r\n"); // BufferedWriter writer;