Skip to content

Commit 3d37f74

Browse files
committed
Merge remote-tracking branch 'origin/main'
# Conflicts: # Core JAVA.md
2 parents 64eed00 + 7f56b6c commit 3d37f74

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
@@ -914,6 +914,26 @@ Example:
914914

915915
---
916916

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+
---
935+
---
936+
917937
<img src="img/JVM%2001.jpg">
918938

919939
In C/C++, this two are allow because of.

0 commit comments

Comments
 (0)