[code="java"] ........
doPost(Request req ,Response rep){
doGet(req,rep);
}
doGet(Request req,Response rep){
new Class2().doRequest(req.getParameter());
}
.......
public class Class2 {
public [color=red]static [/color]Class3 class3 = new Class3();
public String doRequest(String t) throws InterruptedException{
return class3.doSomething(t);
}
}
public class Class3 {
public String doSomething(String t) throws InterruptedException{
//去数据库做一些操作
return t;
}
}[/code]
这样写能不能用static
[b]问题补充:[/b]
public static Class3 class3 = new Class3();
我这里的class3用静态的不会有问题吗?