3
Java's primitive types
• primitive types: 8 simple types for numbers, text, etc.
– Java also has object types, which we'll talk about later
Name Description Examples
– int integers (up to 2
31
- 1) 42, -3, 0, 926394
– double real numbers (up to 10
308
) 3.1, -0.25, 9.4e3
– char single text characters 'a', 'X', '?', '\n'
– boolean logical values true, false
• Why does Java distinguish integers vs. real numbers?
评论0
最新资源