Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么不能将 boolean 类型转换为 int 或 byte,反之亦然。例如:直觉上似乎(int)true应该是1。但它给出了一个例外。相反,在某些情况下,我们将“类型转换”(不是真正意义上的术语)字符串转换为布尔值,例如boolean b=Boolean.valueOf("HI"); Peace。浮士德
(int)true
boolean b=Boolean.valueOf("HI");