[问题] 没有宣告class保留字的类别

楼主: qazsd ( )   2017-03-21 10:59:37
程式码如下:
import javax.ws.rs.core.Response;
@GET
@Produces({"application/json"})
public Response getSearchResults(@Context HttpServletRequest request)
{
String title = request.getParameter("title");
String type = request.getParameter("type");
return search(request, title, null, new String[] { type });
}
而关于Response的定义在https://tinyurl.com/oc8fyse
想请问一般的类别前面不是都会宣告class关键字吗
这种前面只加修饰词的用法是依据什么?
作者: swenj (杰)   2017-03-21 11:03:00
这是方法吧
作者: ssccg (23)   2017-03-21 11:10:00
这显然是method,你怎么会觉得是class?
作者: maxsho (沉默的熊)   2017-03-21 11:35:00
因为这只是一个回传Response的方法 不是类别
作者: qrtt1 (有些事,有时候。。。)   2017-03-21 12:00:00
比较想知道你如何判定它为类别,想理解一下从哪开始出问题
作者: dou0228 (7777)   2017-03-31 09:02:00
? 这是 method 吧
作者: CoNsTaR ((const *))   2017-04-01 03:51:00
因为 java 没有 free function 然后这个方法刚好看起来像在 global scope 吧

Links booklink

Contact Us: admin [ a t ] ucptt.com