当前位置:网站首页>返回值为Object型方法调用equals()
返回值为Object型方法调用equals()
2022-06-25 22:48:00 【zhangsan3333】
package booleanTest;
public class Boolean1 {
private final boolean value = false;
public static void main(String[] args) {
Boolean1 b1 = new Boolean1();
//b传true,i = 1,b传false,i = 0
String i = (b1.getFlag(false).equals(true) ? "1" : "0");
System.out.println("i = " + i);
String i2 = (b1.getFlag(true).equals(true) ? "1" : "0");
System.out.println("i2 = " + i2);
}
public Object getFlag(boolean b) {
return b;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof Boolean) {
return value == ((Boolean)obj).booleanValue();
}
return false;
}
}

边栏推荐
猜你喜欢

How to design the product roadmap?

渗透工具-Burpsuite

统一网关Gateway

“Method Not Allowed“,405问题分析及解决

随便画画的
![[image detection] vascular tracking and diameter estimation based on Gaussian process and Radon transform with matlab code](/img/1d/511dceb9decd73976d577af991afc9.png)
[image detection] vascular tracking and diameter estimation based on Gaussian process and Radon transform with matlab code

Redis的安装及启动

Explain from a process perspective what happens to the browser after entering a URL?

leetcode. 14 --- longest public prefix

How to deliver a shelter hospital within 48 hours?
随机推荐
Ad20 (Altium designer) PCB highlight network
Px4 system terminal for pixhawk
ciscn_2019_en_2
sqlserver 区分字符串中字母大小写
Spark log analysis
Why is it best to use equals for integer comparisons
"Seamless" deployment of paddlenlp model based on openvinotm development kit
Understanding of prototypes and prototype chains
制作3D浪漫炫酷相册【附源码】
How to design the product roadmap?
How to deliver a shelter hospital within 48 hours?
使用VS2022編譯Telegram桌面端(tdesktop)
Solution to component stele in SMT chip processing
Reentrant functions must be used within signal processing functions
10.2.2、Kylin_ Kylin installation, uploading and decompressing, verifying environment variables, starting and accessing
Electronic training.
Qt优秀开源项目之九:qTox
Penetration tool -burpsuite
Stream data
渗透工具-Burpsuite