当前位置:网站首页>Return value is object type method call equals()
Return value is object type method call equals()
2022-06-26 00:57:00 【zhangsan3333】
package booleanTest;
public class Boolean1 {
private final boolean value = false;
public static void main(String[] args) {
Boolean1 b1 = new Boolean1();
//b Pass on true,i = 1,b Pass on 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;
}
}

边栏推荐
猜你喜欢

. Net using access 2010 database

Motor monitoring system based on MCGS and stm32

C # operate with MySQL

Ssl/tls, symmetric and asymmetric encryption, and tlsv1.3

学习识别对话式问答中的后续问题

No executorfactory found to execute the application

"Method not allowed", 405 problem analysis and solution

Machine vision: illuminating "intelligence" and creating a new "vision" world

AD20(Altium Designer) PCB 高亮网络

Compile the telegraph desktop side (tdesktop) using vs2022
随机推荐
Understanding of prototypes and prototype chains
. user. PHP website installation problems caused by INI files
CXF
Chapter V exercises (124, 678, 15, 19, 22) [microcomputer principles] [exercises]
C IO stream (I) basic concept_ Basic definition
Kylin
Anaconda beginner's notes
Px4 system terminal for pixhawk
[image detection] vascular tracking and diameter estimation based on Gaussian process and Radon transform with matlab code
关于EF翻页查询数据库
213. house raiding II
Redisson 3.17.4 发布
Idea set the template of mapper mapping file
Example: use C # Net to teach you how to develop wechat official account (21) -- using wechat to pay online collection: H5 method
Endnote IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS/TIE/TPEL 参考文献格式模板
Vscode shortcut
继承--圣杯模式
Implementation notes of least square fitting conic in stm32
Motor monitoring system based on MCGS and stm32
安卓缓存使用工具类