java - Beanshell 不等于语句

标签 java beanshell

beanshell 中的 if not equal 语句是什么?如果这相等:

if ("myVarValue".equals(vars.get("MY_VARIABLE")))

最佳答案

使用!一元boolean逻辑补运算符:

if (!"myVarValue".equals(vars.get("MY_VARIABLE")))

引用文献

The type of the operand expression of the unary ! operator must be boolean or Boolean, or a compile-time error occurs. The type of the unary logical complement expression is boolean.

At run time, the operand is subject to unboxing conversion if necessary; the value of the unary logical complement expression is true if the (possibly converted) operand value is false and false if the (possibly converted) operand value is true.


测试 if (!something) 的另一个选项是测试 if (something == false)

相关问题

关于java - Beanshell 不等于语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3179359/

相关文章:

java - c++ std::vector<byte> 到 UTF16 编码的字符串

java - 使用 Java 设置 App Engine 数据存储区的光标

java - 如何在 fragment 更新时更新工具栏标题

java - JMeter 使用 ext 文件夹之外的 jar 文件

jmeter - 如何在jmeter中添加集合点

java - 当参数超出范围时,如何在另一个类中创建对象?

java - 使用selenium登录所有浏览器

java - beanshell 新手-运行简单脚本时出错

jmeter - 如何将用户定义变量的值放入Bean shell Sampler变量中 - Jmeter

java - 获取jMeter线程已运行的时间