作者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://www.ptt.cc/bbs/java/M.1490065183.A.A8E.html
→ swenj: 這是方法吧 03/21 11:03
→ ssccg: 這顯然是method,你怎麼會覺得是class? 03/21 11:10
推 maxsho: 因為這只是一個回傳Response的方法 不是類別 03/21 11:35
→ qrtt1: 比較想知道你如何判定它為類別,想理解一下從哪開始出問題 03/21 12:00
→ dou0228: ? 這是 method 吧 03/31 09:02
推 CoNsTaR: 因為 java 沒有 free function 然後這個方法剛好看起來 04/01 03:51
→ CoNsTaR: 像在 global scope 吧 04/01 03:51