Thursday, January 19, 2017

Wednesday, January 18, 2017


The JVM Architecture Explained

for detailsclick here

What are Java heap Young, Old and Permanent Generations?
young generation belongs to heap area
old generation belongs to heap area
permanent generation belongs to Non heap area
for more detailsclick here

Monday, January 2, 2017

Volatile Keyword

Basically when two threads accessing same resource or same instance variable
then it must be read from common shared memory which is main memory for synchronise result.
so make it as volatile
For More Details click Here

Sunday, January 1, 2017

How To remove duplicate rows
DELETE e1 FROM EMPLOYEE e1, EMPLOYEE e2 WHERE e1.name = e2.name AND e1.id > e2.id;
for more details
1.
find Highest salary select MAX(Salary) from Employee;
2.
Find Second Highest Salary
ELECT MAX(Salary) FROM Employee WHERE Salary NOT IN (SELECT MAX(Salary) FROM Employee )
3.
Find Nth Highest Salary
SELECT * /*This is the outer query part */
FROM Employee Emp1
WHERE (N-1) = ( /* Subquery starts here */
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM Employee Emp2
WHERE Emp2.Salary > Emp1.Salary)

we can use limit as well
SELECT Salary FROM Employee
ORDER BY Salary DESC LIMIT n-1,1

Monday, December 26, 2016


public static void main(String[] args) Next, describe what each of public, static, void, main, String[], and args does. It is probably sufficient to just verbalize what each means. But if you want to write each word down as you verbalize, it helps to get the point across.

a) public means that the method is visible everywhere
b) static means you don’t need an instance of the class to call the method
c) void means the method doesn’t return anything
d) main is just the predefined method name for how to start a Java program
e) String[] means the method accepts an array of strings as arguments to the method
f) args is the name of the parameter to the method. Any name will do here. There is no hard and fast requirement that the parameter be called args.

Wednesday, September 14, 2016

Interface


What is an Interface


As you've already learned, objects define their interaction with the outside world through the methods that they expose. Methods form the object's interface with the outside world; the buttons on the front of your television set, for example, are the interface between you and the electrical wiring on the other side of its plastic casing. You press the "power" button to turn the television on and off.


In its most common form, an interface is a group of related methods with empty bodies. A bicycle's behavior, if specified as an interface, might appear as follows:

interface Bicycle {

    //  wheel revolutions per minute
    void changeCadence(int newValue);

    void changeGear(int newValue);

    void speedUp(int increment);

    void applyBrakes(int decrement);
}





To implement this interface, the name of your class would change (to a particular brand of bicycle, for example, such as ACMEBicycle), and you'd use the implements keyword in the class declaration: class ACMEBicycle implements Bicycle { int cadence = 0; int speed = 0; int gear = 1; // The compiler will now require that methods // changeCadence, changeGear, speedUp, and applyBrakes // all be implemented. Compilation will fail if those // methods are missing from this class. void changeCadence(int newValue) { cadence = newValue; } void changeGear(int newValue) { gear = newValue; } void speedUp(int increment) { speed = speed + increment; } void applyBrakes(int decrement) { speed = speed - decrement; } void printStates() { System.out.println("cadence:" + cadence + " speed:" + speed + " gear:" + gear); } }


Interface==product Specification==Rule setter==No implementation==No instantiation==class will give implementation

For more details