当前位置:网站首页>返回值为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;
}
}

边栏推荐
- sqlserver 区分字符串中字母大小写
- 213. house raiding II
- What are the red lines of open source that should not be trodden on?
- Atlas200dk刷机
- Qt之自定义带游标的QSlider
- mysql cluster
- mtb13_Perform extract_blend_Super{Candidate(PrimaryAlternate)_Unique(可NULL过滤_Foreign_index_granulari
- Why do we need to make panels and edges in PCB production
- Reentrant functions must be used within signal processing functions
- Cloud rendering and Intel jointly create the "core" era of cloud rendering
猜你喜欢

Post ordered clue binary tree

Compiler Telegram Desktop end (tdesktop) en utilisant vs2022

制作3D浪漫炫酷相册【附源码】

AD20(Altium Designer) PCB 高亮网络

使用VS2022编译Telegram桌面端(tdesktop)

Anaconda beginner's notes

STM32 uses SPI mode to drive TFT-LCD optimization code of hx8347 scheme

Msp430f5529lp official board (red) can not debug the problem

Balanced binary tree AVL

Idea set the template of mapper mapping file
随机推荐
JS逆向案例:破解登录密码
Why is it best to use equals for integer comparisons
debezium
Blob
Why do we need to make panels and edges in PCB production
Idea kotlin version upgrade
Drag the mouse to rotate the display around an object
Web学习之TypeScript
How to design the product roadmap?
渗透工具-Burpsuite
Atlas200dk brush machine
每日一问:线程和进程的区别
sqlserver 区分字符串中字母大小写
jarvisoj_level2_x64
Post ordered clue binary tree
DPVS fullnat mode management
What training brings happiness
Understanding of prototypes and prototype chains
Cloud rendering and Intel jointly create the "core" era of cloud rendering
Atlas200dk刷机