JAVA中,如下面的代码,"":这问号双引号冒号是什么表达式呀?怎么用?String bizorderid = request.getParameter("bizorderid")==null?"":request.getParameter("bizorderid");
问题描述:
JAVA中,如下面的代码,"":这问号双引号冒号是什么表达式呀?怎么用?
String bizorderid = request.getParameter("bizorderid")==null?"":request.getParameter("bizorderid");
答
二元表达式,可以看成 if else的简写.等同下面的语句.
String bizorderid = “”;
if(request.getParameter("bizorderid")==null){
bizorderid = "";
}else{
bizorderid =request.getParameter("bizorderid");
}