You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+23-21Lines changed: 23 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,42 +18,43 @@
18
18
19
19
##Classloaders and Types
20
20
-[Image](images/JavaClassLoaders.png)
21
-
- A Java program is made up of a number of custom classes (written by programmers like us) and core classes (which come preUpackaged with Java). When a program is executed, JVM needs to load the content of all the needed class. JVM uses a ClassLoader to find the classes.
21
+
- A Java program is made up of a number of custom classes (written by programmers like us) and core classes (which come pre-packaged with Java). When a program is executed, JVM needs to load the content of all the needed class. JVM uses a ClassLoader to find the classes.
22
22
- System Class Loader : Loads all classes from CLASSPATH
23
23
- Extension Class Loader : Loads all classes from extension directory
24
24
- Bootstrap Class Loader : Loads all the Java core files
25
25
- When JVM needs to find a class, it starts with System Class Loader. If it is not found, it checks with Extension Class Loader. If it not found, it goes to the Bootstrap Class Loader. If a class is still not found, a ClassNotFoundException is thrown.
- Primitive: boolean,byte,char ,double, float, int , long,short
34
-
- Reasons
35
-
- null is a possible value
36
-
- use it in a Collection
37
-
- Object like creation from other types.. like String
38
-
39
-
Are instances of Wrapper Classes Immutable?
40
-
- Wrapper classes are final and immutable.
41
33
- Examples of creating wrapper classes are listed below.
42
34
- Integer number = new Integer(55);//int;
43
35
- Integer number2 = new Integer("55");//String
44
36
- Float number3 = new Float(55.0);//double argument
45
-
- Float number4 = new Float(55.0f);//float argument Float number5 = new Float("55.0f");//String
37
+
- Float number4 = new Float(55.0f);//float argument
38
+
- Float number5 = new Float("55.0f");//String
46
39
- Character c1 = new Character('C');//Only char constructor
47
40
- Boolean b = new Boolean(true);
41
+
- Reasons
42
+
- null is a possible value
43
+
- use it in a Collection
44
+
- Object like creation from other types.. like String
48
45
49
-
What is Auto Boxing?
46
+
##Are instances of Wrapper Classes Immutable?
47
+
- What is Immutability?
48
+
- Wrapper classes are final and immutable.
49
+
50
+
##What is Auto Boxing?
50
51
```
51
52
// Auto Boxing
52
53
Integer ten = 10;//new Integer(10);
53
54
ten++;// allowed. Java does had work behind the screen for us
54
55
```
55
-
Boxing and new instances
56
-
Auto Boxing helps in saving memory by reusing already created Wrapper objects. However wrapper classes created using new are not reused.
56
+
57
+
- Boxing and new instances - Auto Boxing helps in saving memory by reusing already created Wrapper objects. However wrapper classes created using new are not reused.
57
58
```
58
59
// Two wrapper objects created using new are not same object
59
60
Integer nineA = new Integer(9);
@@ -67,8 +68,9 @@ Auto Boxing helps in saving memory by reusing already created Wrapper
-Reuse Through Inheritance - [TestReuse.java](src/main/java/com/in28minutes/java/oops/inheritance/reuse/TestReuse.java)[Hero.java](src/main/java/com/in28minutes/java/oops/inheritance/reuse/Hero.java)[Actor.java](src/main/java/com/in28minutes/java/oops/inheritance/reuse/Actor.java)[Comedian.java](src/main/java/com/in28minutes/java/oops/inheritance/reuse/Comedian.java)
0 commit comments