Skip to content

Commit f0ba0e0

Browse files
author
Alan
committed
changed object types
1 parent 099f343 commit f0ba0e0

5 files changed

+41
-94
lines changed

DataTypeCateg/ObjectType.java

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
import java.util.*;
3+
public class ObjectType
4+
{
5+
public static void logLn(Object o){System.out.println(o);}
6+
7+
public static void main(String[] args)
8+
{
9+
/**
10+
* OBJECT TYPES EXTEND java.lang.Object IMPLICITLY
11+
* ARRAYS ARE ALSO OBJECTS
12+
*/
13+
List<String> li = new ArrayList<>();
14+
li.add("spongebob");
15+
li.add("patrick");
16+
logLn(li);
17+
}
18+
}
19+

DataTypeCateg/PrimitiveType.java

+22-31
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
1-
package com.ramo;
1+
public class PrimitiveType
2+
{
3+
public static void logLn(Object o){System.out.println(o);}
24

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+
*/
319

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+
}

DataTypeCateg/ReferenceType1.java

-27
This file was deleted.

DataTypeCateg/ReferenceType2.java

-20
This file was deleted.

DataTypeCateg/ReferenceType3.java

-16
This file was deleted.

0 commit comments

Comments
 (0)