String str = "Hello*";
String s = str.replaceAll(Pattern.quote("*")," ");
System.out.println(s);
This Blog Helps to Learn Java Technology And Its Supportive Frameworks With Working Examples.
if(x == 5) //The 'Check'
{
y = x * 2; //The 'Act'
//If x is changed by another thread in between the if(x==5) and the "y=x*5", y will not be equal to 10.
}
//Obtain lock for x
if(x == 5)
{
y = x * 2; //Now, nothing can change x until the lock is released. Therefore y = 10
}
//release lock for x