Skip to content

Commit 7f56b6c

Browse files
authored
Update Core JAVA.md
1 parent 1e77dcc commit 7f56b6c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Core JAVA.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,3 +912,23 @@ Example:
912912
| Size | 4 bytes | 8 bytes |
913913
| Range | -1.7E38 to 1.7E38 | -1.7E308 to 1.7E308
914914

915+
---
916+
917+
918+
# 🎯 **boolean**
919+
920+
**Feature** | **Value**
921+
---|---
922+
**Size** | 1 bit (although JVM implementations often use 1 byte for internal representation)
923+
**Value** | `true` or `false`
924+
925+
🔸 **Common Compile-Time Errors with boolean**
926+
927+
**Code** | **Result** | **Compiler Message (error)**
928+
---|---|---
929+
`boolean b = true;` | ✅ Valid | —
930+
`boolean b = 0;` | ❌ Invalid | Incompatible types, found: int, required: boolean
931+
`boolean b = True;` | ❌ Invalid | Cannot find symbol, symbol: variable True, location: class Test
932+
`boolean b = "true";` | ❌ Invalid | Incompatible types, found: java.lang.String, required: boolean
933+
934+
---

0 commit comments

Comments
 (0)