Test to check performance. public class Main { public static void main(String[] args) { int A = 77777777; long l;…
Examples. String car = “car”; String car2= “car”; System.out.println(car != car2); System.out.println(car == car2); If we run above code, we…
Final Example. class ExampleOfFinal{ public static void main (String[] args){ final int y = 1; y = 2; // There…
Main difference. More details. Stack: Stack is stored in computer RAM. As mentioned above, variables and function uses stack, memory…
Overriding Example. class Tax{ public void calculateTax(){ System.out.println(“Total tax: state plus federal.”); } } class StateTax extends Tax{ public void…
synchronized(LOCK) { Thread.sleep(100); // here LOCK is held } synchronized(LOCK) { LOCK.wait(); // here LOCK is not held }…
Comparator and Comparable both are used to sort collection of object by its property. Comparator sorting example. Object that needs…