UNIT-1 java contains basics of java oops concepts explanation output and input statement in java
jayasmruthicmscse
38 views
93 slides
Jun 14, 2024
Slide 1 of 93
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
About This Presentation
UNIT-1 java contains basics of java oops concepts explanation output and input statement in java
Size: 3.95 MB
Language: en
Added: Jun 14, 2024
Slides: 93 pages
Slide Content
JAVA PROGRAMMING UNIT-
1
Introduction to Java ,Classes and object
Phases of Garbage Collection in Java
•A standard Garbage Collection implementation involves three
phases:
•Mark objects as alive
•Sweep dead objects
•Compact remaining objects in memory
What is Generational Garbage Collection in Java?
Types of Garbage Collector
•SerialGarbageCollector
•ParallelGarbageCollector
•ConcurrentMarkSweep(CMS)GarbageCollector
•GarbageFirst(G1)GarbageCollector
Java stack class
e The Java collections framework has a class
named Stack that provides the functionality of the
stack data structure.
Stack Implementation
e In stack, elements are stored and accessed in Last In First
Out manner. That is, elements are added to the top of the stack
and removed from the top of the stack.
Push — Pop
remove element
Creating a stack
+ In order to create a stack, we must import
the java.util.Stack package first. Once we import the
package, here is how we can create a stack in Java.
Stack<Type> stacks = new Stack<>();
Here, Type indicates the stack's type. For example,
// Create Integer type stack
Stack<Integer> stacks = new Stack<>();
// Create String type stack
Stack<String> stacks = new Stack<>Q);
Stack methods
empty() Checks if the stack is empty
push() Pust an item to the top of the stack
0000 Remove the object from the stack
peek()
Looks at the object of a stack without removing it