-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore_concepts.txt
More file actions
81 lines (54 loc) · 2.65 KB
/
core_concepts.txt
File metadata and controls
81 lines (54 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
when we write some state in the class, we can access it via two ways:
1. plain access: state
2. reference access: this.state
interface is an entity in java which contains the functions without any proper implementation
there are two things: extends and implements
extends:
-class and class (inheritance: single, multilevel, hierarchial)
-interface and interface (inheritance: single, multilevel, hierarchial)
implements:
-class and interface (solution of the diamond problem)
-if we implement an interface from a class, we have to override the functions of the interface and write their concrete
implementation
extends:
class extends class
1 class cannot extend multiple classes
1 class can be extended by multiple classes
interface extends interface
1 interface can extend multiple interfaces
1 interface can be extended by multiple interfaces
implements:
class implements interface
1 class can implement multiple interfaces
1 interface can be implemented by multiple classes
private:
cannot be inherited by the subclasses/interfaces
static:
static entities can be accessed by static or non-static
non-static entities can be accessed by non-static but non static
compile-time v/s run-time:
during compile time:
-the control is with the programmer com
-compilation of code is done by compiler
-output is compiled code
-compiler checks for the grammar of the language or the syntax
during run time:
-the control is with the machine
-running is done by the JVM
-output is the bytecode
-JVM checks whether the program is able to interact properly with the hardware or not
null v/s undefined:
null is an actual value, which symbolizes nothing
undefined means that entity is not even defined in the application code
e.g., suppose we define some string but dont initialize it, then we will get its value as null on access, but if we dont
define some string variable in the code and still try to access it, then it gives us the undefined
why fields and methods are not generic?
because their types are injected by the generic type present in their generic class and therefore they dont need to be generic
why constructors are generic?
because while creating the object, the type injected into the class should be provided and the object creation occurs
via the constructor which means that the provisioning of the type can happen via the constructor itself and therefore, it
should be generic too, just like the class
ek kam karo:
short notes banao and usmein likho ki kaunsa keyword kahan lag sakta hain and kaise kam kar raha hain
mixing of keywords ka socho
questions practice karo