Refresh Your Java - Before Java Interview
We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....
A race
condition occurs when the order of execution of two or more
threads may affect
some variable or outcome in the
program. It may turn out that all the different
possible
thread orderings have the same final effect on
the application: the effect caused by the race
condition
may be insignificant, and may not even be relevant.
Synchronized keyword can
be applied to static/non-static methods or a block of code to
make
your code Thread Safe. Only one thread at
a time can access synchronized methods and if
there are
multiple threads trying to access the same method then other
threads have to
wait for the execution of method by one
thread. Synchronized keyword provides a lock
on the object
and thus prevents race condition.
public void
synchronized method(){}
public void
synchronized staticmethod(){}
public void
myMethod(){
synchronized
(this){
}
}
This Portal is intended to put all Java/J2ee related topics at one single place for quick referance, not only Technical , but also the Project Management Related thing such as Development Process methodoogies build process, unit testing etc.,
This Portal has More than 500 Java Interview Questions (also could be Considered as Quick Notes) very neatly separated topic by topic with simple diagrams which makes you easily understandable. Importantly these are from our Realtime expericance.