public void meow(){
synchronized (Cat.class) {
sout("meow");
}
}
Let's say program has cat1 cat2 cat3 objects.
If cat1 wants to run the meow function first, let cat1 run it first,
if cat2 wants it to run second, cat2 should run it and then cat3 last.
FIFO logic.
However, I think jvm normally sets this itself, so I cannot prioritize it according to the request order. How can I do this in java?
I need an easy way.