日期:2014-05-20  浏览次数:20687 次

初学java,碰到简单面试题:(
how   to   answer   following   questions   in   english:

1.How   to   lock   thread   resources   in   java?

2.please   give   a   example   of   MVC   implementation?

------解决方案--------------------
1.synchronized(this)
2.Struts WebWork Spring
------解决方案--------------------
1.synchronized
2.struts MVC
------解决方案--------------------
synchronized(this);
wait();

Struts Spring WebWork
------解决方案--------------------
题1:
The Java programming language does not provide a way to perform separate lock and unlock actions; instead, they are implicitly performed by high-level constructs that arrange always to pair such actions correctly.
however, that the Java virtual machine provides separate monitorenter and monitorexit instructions that implement the lock and unlock actions.
题2:
Spring、Struts、Eclipse are all the implementations of the MVC pattern.