1
- package com .ramo ;
1
+ public class PrimitiveType
2
+ {
3
+ public static void logLn (Object o ){System .out .println (o );}
2
4
5
+ public static void main (String [] args )
6
+ {
7
+ /**
8
+ * PRIMITIVE TYPES HAVE WRAPPER CLASSES OBJECT TYPES
9
+ * boolean : Boolean
10
+ * byte: Byte
11
+ * char: Character
12
+ * short: Short
13
+ * int: Integer
14
+ * long: Long
15
+ * float: Float
16
+ * double: Double
17
+ *
18
+ */
3
19
4
- public class PrimitiveType {
5
- public static void main (String [] args )
6
- {
7
- //declaration of variable
8
- byte age =26 ;
9
- long viewsCount =123_456_789L ;
10
- //the l suffix is used to indicate it is a long data type
11
- System .out .println (age );
12
- //by default a decimal is assumed as a double we need the f
13
- //suffix at the end to tell the compiler this is a float
14
- float price =10.99f ;
15
- //we always store a char in between single quotes
16
- char letter = 'a' ;
17
- //we store a str in between double quotes
18
- String myProperty = "This is my property." ;
19
- boolean isEligibleForLoan =true ;
20
- /*
21
- Date Type Notes:
22
- Byte uses 1 byte of memory has a range of: [-128,127]
23
- bool uses 1 byte of memory and can store two values only: true/false
24
- Short uses 2 bytes of memory and has a range of: [-32000,32000]
25
- Integer uses 4 bytes of memory and has a range of: [-2000000000,2000000000]
26
- float uses 4 bytes of memory
27
- long uses 8 bytes of memory
28
- double uses 8 bytes of memory
29
- String uses 1 bytes of memory and is notated with double quotes(meaning "Ramo"=4 bytes)
30
- char which stands for character takes up 2 bytes of memory and is notated with single quotes(meaning 'a')
31
- */
32
- }
33
- }
20
+ int x = 4 ;
21
+ logLn (x ); //will give us 4
22
+
23
+ }
24
+ }
0 commit comments