1.Java WinForm项目
public static void main(String[] args) {
String testString="22";
String testString2="1096";
String testString3="22";
Student student=new Student();
student.Age="22";
Test(student.Age);
Test2(student.Age);
}
public static void Test(String a)
{
if(a=="22")
{
System.out.println("Input 22");
}
else {
System.out.println("Input else");
}
}
public static void Test2(String a)
{
if(a.equals("22"))
{
System.out.println("Input 22");
}
else {
System.out.println("Input else");
}
}
执行结果:
2.Java Sprint Boot项目
@ApiOperation("查询操作")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "sql", dataType = "String", required = true, value = "查询语句", defaultValue = ""),
})
@RequestMapping(value = "/Query", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public List<LinkedHashMap> Query(String sql) {
/*
int a = 0;
List<LinkedHashMap> rs = new ArrayList<>();
return rs;*/
JSONArray jsonArray=new JSONArray();
JSONObject jsonObject=new JSONObject();
if(sql=="a")
{
jsonObject.put("type1","=");
}
if(sql.equals("a"))
{
jsonObject.put("type2","a");
}
jsonArray.add(jsonObject);
return jsonArray;
}
执行结果: