我从来不需要创建一个对象类的对象它认为很多程序员以前没有做过这件事。如果您需要创建 Object 类,请分享该条件,否则我想知道为什么 Object Class 不是抽象的,而我们从不创建 Object 类的对象。
问问题
1115 次
2 回答
4
I do create objects of type Object
which are very useful when using locks in multithreading applications. This perfectly answers the question, I need an object of any type that I can lock on and the first thing that comes to mind is Object
public class MultiThreadedClass{
Object lock = new Object();
// ...
public void useSharedResource(){
synchronized(lock){
...
}
}
}
于 2012-07-03T19:02:18.570 回答
2
I have actually created a new Objects to use for synchronization & locking.
于 2012-07-03T19:02:38.063 回答