作者qazsd (watching you)
看板java
标题[问题] 没有宣告class保留字的类别
时间Tue Mar 21 10:59:37 2017
程式码如下:
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关键字吗
这种前面只加修饰词的用法是依据什麽?
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 59.124.165.66
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/java/M.1490065183.A.A8E.html
1F:→ swenj: 这是方法吧 03/21 11:03
2F:→ ssccg: 这显然是method,你怎麽会觉得是class? 03/21 11:10
3F:推 maxsho: 因为这只是一个回传Response的方法 不是类别 03/21 11:35
4F:→ qrtt1: 比较想知道你如何判定它为类别,想理解一下从哪开始出问题 03/21 12:00
5F:→ dou0228: ? 这是 method 吧 03/31 09:02
6F:推 CoNsTaR: 因为 java 没有 free function 然後这个方法刚好看起来 04/01 03:51
7F:→ CoNsTaR: 像在 global scope 吧 04/01 03:51