Last active
August 18, 2021 15:30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Temp2 { | |
private int age = 10; | |
private synchronized void hello(String name, int age){ | |
String temp = "hello " + name + " there. "; | |
synchronized(this){ | |
this.age = age; | |
} | |
System.out.println(temp + " Age: " + age); | |
} | |
public static void main(String[] args){ | |
Temp2 t2 = new Temp2(); | |
t2.hello("user_name", 20); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment