WEBVTT

1
00:00:00.080 --> 00:00:03.160
<v Speaker 1>You know that feeling right, that pressure just before a

2
00:00:03.160 --> 00:00:07.120
<v Speaker 1>big professional interview, especially somewhere like Java. It's such a

3
00:00:07.200 --> 00:00:08.279
<v Speaker 1>dynamic field.

4
00:00:08.400 --> 00:00:09.359
<v Speaker 2>Oh yeah, definitely.

5
00:00:09.400 --> 00:00:11.599
<v Speaker 1>It's really not just about whether you know the syntax,

6
00:00:11.679 --> 00:00:12.519
<v Speaker 1>is it not at all.

7
00:00:12.960 --> 00:00:13.720
<v Speaker 2>It's much deeper.

8
00:00:13.839 --> 00:00:17.679
<v Speaker 1>It's understanding the core ideas, the architecture underneath it all,

9
00:00:17.719 --> 00:00:21.600
<v Speaker 1>and maybe surprisingly those non technical bits that can really

10
00:00:21.640 --> 00:00:22.559
<v Speaker 1>make you stand.

11
00:00:22.320 --> 00:00:24.160
<v Speaker 2>Out exactly the human element.

12
00:00:24.440 --> 00:00:27.480
<v Speaker 1>Welcome to the deep dive today. We're diving into a

13
00:00:27.519 --> 00:00:32.600
<v Speaker 1>really practical resource, Java Professional Interview Guide by Mandar maheshwar

14
00:00:32.799 --> 00:00:36.119
<v Speaker 1>Jog mm hm. And our goal here isn't just you know,

15
00:00:36.679 --> 00:00:38.359
<v Speaker 1>listing questions and answers.

16
00:00:38.439 --> 00:00:39.320
<v Speaker 2>Oh, that's not the point.

17
00:00:39.439 --> 00:00:41.560
<v Speaker 1>We want to pull out the key insights, the whyse

18
00:00:41.719 --> 00:00:44.399
<v Speaker 1>behind the what's maybe even some unexpected stuff that really

19
00:00:44.399 --> 00:00:48.079
<v Speaker 1>makes you well informed, well prepared for that Java interview.

20
00:00:48.320 --> 00:00:51.840
<v Speaker 2>Think of it as getting up to speed quickly but

21
00:00:51.920 --> 00:00:53.039
<v Speaker 2>properly with.

22
00:00:53.039 --> 00:00:55.799
<v Speaker 1>Stepth exactly, getting that real understanding.

23
00:00:56.039 --> 00:00:59.079
<v Speaker 2>That's the plan. We're going beyond just definitions, looking at

24
00:00:59.079 --> 00:01:03.240
<v Speaker 2>the practical side, the strategy that Mandar's guide really highlights, and.

25
00:01:03.200 --> 00:01:07.439
<v Speaker 1>Where better to start than, maybe counterintuitively, the human side

26
00:01:07.439 --> 00:01:10.000
<v Speaker 1>of it all. The interview process itself.

27
00:01:10.280 --> 00:01:15.120
<v Speaker 2>Right, because just being technically brilliant, Yeah, it's often not

28
00:01:15.280 --> 00:01:15.799
<v Speaker 2>enough as.

29
00:01:15.719 --> 00:01:21.079
<v Speaker 1>It rarely guarantees the job. No, the guide really emphasizes

30
00:01:21.159 --> 00:01:23.760
<v Speaker 1>setting the stage, those non technical things you need to

31
00:01:23.840 --> 00:01:26.159
<v Speaker 1>navigate just to get to the technical part. Yeah, Like,

32
00:01:26.359 --> 00:01:28.599
<v Speaker 1>how do you even find these Java opportunities in the

33
00:01:28.599 --> 00:01:30.439
<v Speaker 1>first place? What does a guide say about that?

34
00:01:30.599 --> 00:01:33.159
<v Speaker 2>Well, it boils down to two main routes. Typically, you've

35
00:01:33.159 --> 00:01:37.480
<v Speaker 2>got your on campus recruitment okay, which often focuses more

36
00:01:37.480 --> 00:01:41.200
<v Speaker 2>on aptitude, maybe some CC plus plus R your grades,

37
00:01:41.239 --> 00:01:44.359
<v Speaker 2>that sort of thing generally a bit easier. Maybe. Then

38
00:01:44.359 --> 00:01:47.879
<v Speaker 2>there's off campus that's usually through job portals, company websites,

39
00:01:48.280 --> 00:01:51.120
<v Speaker 2>sometimes even those big walk in events a yeah, and

40
00:01:51.280 --> 00:01:54.079
<v Speaker 2>these tend to be well technically tougher. So knowing that

41
00:01:54.200 --> 00:01:55.359
<v Speaker 2>helps you kind of shape.

42
00:01:55.079 --> 00:01:57.400
<v Speaker 1>Your prep and the range of roles once you're in.

43
00:01:58.000 --> 00:02:00.680
<v Speaker 1>It's huge. The guide points us out really well, it

44
00:02:00.760 --> 00:02:02.959
<v Speaker 1>really is. You could be a full stack dev front end,

45
00:02:02.959 --> 00:02:06.519
<v Speaker 1>back end the works, or specialized as a Java web

46
00:02:06.519 --> 00:02:10.439
<v Speaker 1>developer or obviously mobile apps, Android development being a big

47
00:02:10.439 --> 00:02:11.080
<v Speaker 1>one for Java.

48
00:02:11.159 --> 00:02:12.199
<v Speaker 2>Still huge. Yeah.

49
00:02:12.319 --> 00:02:16.240
<v Speaker 1>Then there's the enterprise side Java E developers building those

50
00:02:16.319 --> 00:02:20.800
<v Speaker 1>big scalable systems with things like spring Hibernate.

51
00:02:20.560 --> 00:02:22.400
<v Speaker 2>Rest crucial roles, and.

52
00:02:22.360 --> 00:02:26.840
<v Speaker 1>Increasingly Java API developers often using spring boot to build

53
00:02:26.840 --> 00:02:29.759
<v Speaker 1>out those rest APIs that power everything. It's a really

54
00:02:29.840 --> 00:02:30.840
<v Speaker 1>wide field.

55
00:02:30.680 --> 00:02:34.120
<v Speaker 2>Absolutely, so once you found a role that fits, there's

56
00:02:34.159 --> 00:02:37.360
<v Speaker 2>the selection process itself, like a pipeline, right. It often

57
00:02:37.439 --> 00:02:39.800
<v Speaker 2>kicks off with a phone interview, could be a surprise

58
00:02:39.879 --> 00:02:43.080
<v Speaker 2>call from HR, maybe scheduled, sometimes even a technical panel

59
00:02:43.159 --> 00:02:45.639
<v Speaker 2>right off the bat, and a simple pip but honestly

60
00:02:45.919 --> 00:02:50.319
<v Speaker 2>so important find a quiet place, no distractions.

61
00:02:50.520 --> 00:02:52.560
<v Speaker 1>Sounds obvious, but easily forgotten in the moment.

62
00:02:52.639 --> 00:02:54.319
<v Speaker 2>Totally first impressions count.

63
00:02:54.520 --> 00:02:57.080
<v Speaker 1>So after that initial phone screen usually.

64
00:02:56.759 --> 00:02:59.680
<v Speaker 2>Technical tests come next. The guide mentions two main flavors,

65
00:03:00.400 --> 00:03:02.960
<v Speaker 2>multiple choice questions MCQs. You see those a lot non

66
00:03:03.039 --> 00:03:06.520
<v Speaker 2>campus drives. They mix aptitude with technical stuff c C

67
00:03:06.680 --> 00:03:10.879
<v Speaker 2>plus plus AID SQL Java right, and then algorithm based

68
00:03:10.879 --> 00:03:13.240
<v Speaker 2>tests more focused problem solving.

69
00:03:13.479 --> 00:03:17.360
<v Speaker 1>And the point is just efficiency.

70
00:03:16.960 --> 00:03:20.159
<v Speaker 2>Pretty much, yeah, filtering candidates effectively before you get to

71
00:03:20.159 --> 00:03:22.800
<v Speaker 2>the more intensive face to face interviews.

72
00:03:22.599 --> 00:03:25.639
<v Speaker 1>Which leads us there the face to face what's the approach?

73
00:03:25.759 --> 00:03:27.240
<v Speaker 1>Is there a standard way it goes?

74
00:03:27.759 --> 00:03:31.599
<v Speaker 2>Not really a fixed rule, no, but often it builds

75
00:03:31.639 --> 00:03:34.400
<v Speaker 2>on how you did in those technical tests. Make sense,

76
00:03:34.560 --> 00:03:38.080
<v Speaker 2>But here's the key. They're really trying to understand your concepts,

77
00:03:38.360 --> 00:03:42.639
<v Speaker 2>not just rope memorization, but can you apply it like well,

78
00:03:42.639 --> 00:03:45.120
<v Speaker 2>say you're interviewing for a role involving I don't know

79
00:03:45.240 --> 00:03:49.639
<v Speaker 2>a stock trading system, expect deep questions on concurrency.

80
00:03:49.879 --> 00:03:52.240
<v Speaker 1>Ah, right, high stakes there exactly.

81
00:03:52.719 --> 00:03:55.120
<v Speaker 2>Or if it's an e commerce site, they'll probe hard

82
00:03:55.280 --> 00:03:59.560
<v Speaker 2>on database transactions, data consistency. It's about applying the knowledge

83
00:03:59.599 --> 00:04:00.680
<v Speaker 2>to theext You know.

84
00:04:00.719 --> 00:04:02.599
<v Speaker 1>What I found really refreshing in the guide, and it's

85
00:04:02.639 --> 00:04:04.879
<v Speaker 1>something people stress about. Is the idea that it's okay

86
00:04:04.919 --> 00:04:06.039
<v Speaker 1>not to know everything.

87
00:04:06.319 --> 00:04:08.280
<v Speaker 2>Yes, that's such a crucial point.

88
00:04:08.360 --> 00:04:11.639
<v Speaker 1>The advice is just accept it politely. Remember development is

89
00:04:11.680 --> 00:04:14.360
<v Speaker 1>a team effort, right. We rely on collective knowledge.

90
00:04:14.479 --> 00:04:19.800
<v Speaker 2>Absolutely. It shows humility, honesty, and that you understand how

91
00:04:19.839 --> 00:04:23.000
<v Speaker 2>real teams work. It's not just about being the solo genius.

92
00:04:23.079 --> 00:04:26.319
<v Speaker 1>It shifts the focus. Interviewers aren't just ticking boxes on

93
00:04:26.360 --> 00:04:27.360
<v Speaker 1>technical knowledge.

94
00:04:27.519 --> 00:04:30.240
<v Speaker 2>No, they're looking at the whole picture. Yeah, your job

95
00:04:30.319 --> 00:04:34.319
<v Speaker 2>competence for sure? What projects have you actually done? What

96
00:04:34.439 --> 00:04:36.959
<v Speaker 2>problems did you solve? How much effort did you put in,

97
00:04:37.040 --> 00:04:41.000
<v Speaker 2>but also team fit hugely important. Yeah, would they actually

98
00:04:41.079 --> 00:04:43.160
<v Speaker 2>enjoy working with you day to day? How are your

99
00:04:43.160 --> 00:04:46.319
<v Speaker 2>interpersonal skills? Can you handle disagreements constructively?

100
00:04:46.360 --> 00:04:48.079
<v Speaker 1>It's often the decider, isn't it.

101
00:04:47.879 --> 00:04:50.199
<v Speaker 2>It really can be. And then there's learning agility.

102
00:04:50.279 --> 00:04:52.079
<v Speaker 1>How quickly you pick things up exactly?

103
00:04:52.240 --> 00:04:55.959
<v Speaker 2>Tech moves fast. Companies need people who can learn new tools,

104
00:04:56.040 --> 00:05:00.000
<v Speaker 2>new frameworks quickly. They'll provide training, sure, but they expect

105
00:05:00.120 --> 00:05:01.399
<v Speaker 2>you to become proficient fast.

106
00:05:01.720 --> 00:05:03.639
<v Speaker 1>And the final piece trustworthiness.

107
00:05:04.439 --> 00:05:07.759
<v Speaker 2>Fundamentally, are you a good team player? Are you reliable?

108
00:05:08.120 --> 00:05:11.279
<v Speaker 2>Will you fit the culture? Once the technical side is cleared,

109
00:05:11.560 --> 00:05:12.600
<v Speaker 2>this becomes critical.

110
00:05:12.879 --> 00:05:17.480
<v Speaker 1>So the guide offers some mantras for success. Practical tips, Yeah.

111
00:05:17.360 --> 00:05:21.959
<v Speaker 2>Some really good ones. Answer correctly obviously, but crucially in

112
00:05:22.040 --> 00:05:22.800
<v Speaker 2>your own words.

113
00:05:23.000 --> 00:05:25.279
<v Speaker 1>Ah, not just reciting definition.

114
00:05:24.959 --> 00:05:28.439
<v Speaker 2>Right, give real examples, show it you understand it, don't

115
00:05:28.519 --> 00:05:32.959
<v Speaker 2>just know it. And body language, project confidence, show your serious.

116
00:05:32.759 --> 00:05:34.480
<v Speaker 1>And research the company essential.

117
00:05:34.920 --> 00:05:37.759
<v Speaker 2>Know what they do, their products, their area. And this

118
00:05:37.800 --> 00:05:41.639
<v Speaker 2>is a big one. Know your resume or CV inside out.

119
00:05:41.959 --> 00:05:45.360
<v Speaker 1>Don't list skills you can't back up never, it's a killer.

120
00:05:45.480 --> 00:05:49.040
<v Speaker 1>And speaking of resumes, the guide clarifies that CV versus

121
00:05:49.120 --> 00:05:51.240
<v Speaker 1>resume distinction, which trips people up.

122
00:05:51.319 --> 00:05:54.720
<v Speaker 2>Yeah, it's a good clarification. A CB curriculum VITA is

123
00:05:54.839 --> 00:05:59.439
<v Speaker 2>usually for freshers, focuses on academics, projects, maybe publications.

124
00:05:59.000 --> 00:06:00.959
<v Speaker 1>Your whole academic life basically, right.

125
00:06:00.839 --> 00:06:03.360
<v Speaker 2>Whereas a resume is for experienced folks. It's about your

126
00:06:03.399 --> 00:06:07.600
<v Speaker 2>career path, your roles, key achievement, certifications, different focus. Knowing

127
00:06:07.639 --> 00:06:09.759
<v Speaker 2>which one to use is a small but important detail.

128
00:06:09.839 --> 00:06:12.920
<v Speaker 1>Okay, so we've navigated the human side the process. Now

129
00:06:13.000 --> 00:06:16.079
<v Speaker 1>let's get into the technical core, the Java itself. Where

130
00:06:16.079 --> 00:06:19.360
<v Speaker 1>does the guide start with the architecture? How does Java

131
00:06:19.360 --> 00:06:20.519
<v Speaker 1>code actually run?

132
00:06:20.839 --> 00:06:23.600
<v Speaker 2>It starts right at the beginning. Your source code, the

133
00:06:23.639 --> 00:06:26.759
<v Speaker 2>dot java file, what we write exactly. That gets fed

134
00:06:26.800 --> 00:06:31.319
<v Speaker 2>into the compiler javac, which produces bytcode the dot class file. Okay,

135
00:06:31.399 --> 00:06:34.000
<v Speaker 2>and that bytecode is what's executed by the Java Virtual

136
00:06:34.040 --> 00:06:37.959
<v Speaker 2>Machine the JVM. That's the basic flow source to bytcode

137
00:06:38.000 --> 00:06:38.920
<v Speaker 2>to JVM.

138
00:06:38.600 --> 00:06:42.279
<v Speaker 1>Execution, and the guide highlights something specific in that flow,

139
00:06:42.319 --> 00:06:45.120
<v Speaker 1>a kind of gatekeeper, the bytecode verifier.

140
00:06:45.279 --> 00:06:48.920
<v Speaker 2>Yes, this is fascinating and often overlooked. It's a crucial

141
00:06:48.920 --> 00:06:49.800
<v Speaker 2>security layer.

142
00:06:49.879 --> 00:06:53.000
<v Speaker 1>Why is it needed if the compiler made the bit code.

143
00:06:53.360 --> 00:06:57.120
<v Speaker 2>But here's the thing. Even after compilation, someone would say,

144
00:06:57.319 --> 00:07:00.800
<v Speaker 2>assemblying knowledge could potentially modify that class fall they could

145
00:07:00.839 --> 00:07:04.000
<v Speaker 2>try to sneak in malicious or just broken code.

146
00:07:04.079 --> 00:07:05.279
<v Speaker 1>Right, okay, I see the.

147
00:07:05.199 --> 00:07:08.000
<v Speaker 2>Bicode verifier acts as a guard. Before the JVM runs

148
00:07:08.000 --> 00:07:10.480
<v Speaker 2>the code. It checks for things like is the operants

149
00:07:10.519 --> 00:07:14.480
<v Speaker 2>dat consistent? Are variables initialized? Is code trying to access

150
00:07:14.480 --> 00:07:17.240
<v Speaker 2>private data illegally? Our final rules being broken?

151
00:07:17.319 --> 00:07:19.639
<v Speaker 1>So it's protecting the JVM itself from bad bytecode.

152
00:07:19.759 --> 00:07:22.839
<v Speaker 2>Precisely, it ensures the bytecode adheres to the rules, keeping

153
00:07:22.879 --> 00:07:26.199
<v Speaker 2>the runtime environment stable and secure. A really vital component.

154
00:07:26.519 --> 00:07:29.199
<v Speaker 1>Vital, but maybe not something you think about daily. Now,

155
00:07:29.199 --> 00:07:33.920
<v Speaker 1>those three acronyms that always come up, JVM, JR, JDK.

156
00:07:34.560 --> 00:07:36.079
<v Speaker 1>Can we quickly nail down the difference?

157
00:07:36.160 --> 00:07:38.800
<v Speaker 2>Sure, let's break it down. The JVM, the Java Virtual

158
00:07:38.839 --> 00:07:41.879
<v Speaker 2>machine is the heart. It's the thing that actually runs

159
00:07:41.879 --> 00:07:44.879
<v Speaker 2>the bit code. The runtime engine, got it engine, the JR,

160
00:07:45.199 --> 00:07:49.360
<v Speaker 2>the Java runtime environment, the JVM plus all the standard

161
00:07:49.439 --> 00:07:52.959
<v Speaker 2>libraries and files needed to actually run a Java application.

162
00:07:53.240 --> 00:07:55.040
<v Speaker 2>If you just want to run a Java program, someone

163
00:07:55.079 --> 00:07:56.240
<v Speaker 2>else wrote, you need the JR.

164
00:07:56.519 --> 00:07:58.959
<v Speaker 1>Okay, JVM plus libraries, runtime.

165
00:07:58.639 --> 00:08:01.800
<v Speaker 2>Exactly and the JDK, the Java Development Kit is the

166
00:08:01.839 --> 00:08:04.600
<v Speaker 2>whole package for developers. It includes the JRE so you

167
00:08:04.600 --> 00:08:08.120
<v Speaker 2>can run things, plus the development tools, the compiler, javact,

168
00:08:08.120 --> 00:08:09.319
<v Speaker 2>the debugger, all that stuff.

169
00:08:09.399 --> 00:08:12.560
<v Speaker 1>So jdk's for writing code, JRE is just for running it.

170
00:08:12.639 --> 00:08:14.680
<v Speaker 2>That's the core distinction developed versus.

171
00:08:14.519 --> 00:08:20.079
<v Speaker 1>Run perfect Now shifting to object oriented programming OOP. These

172
00:08:20.160 --> 00:08:23.600
<v Speaker 1>are the absolute fundamentals of Java. The guide really pushes

173
00:08:23.639 --> 00:08:26.600
<v Speaker 1>the why behind them. Let's start with encapsulation, the art

174
00:08:26.639 --> 00:08:30.199
<v Speaker 1>of hiding. What's the real benefit beyond just private fields

175
00:08:30.199 --> 00:08:31.199
<v Speaker 1>and public methods.

176
00:08:31.360 --> 00:08:35.279
<v Speaker 2>It's really about control and maintainability. Sure, you hide internal

177
00:08:35.360 --> 00:08:39.480
<v Speaker 2>data using private exposed behavior via public methods.

178
00:08:39.559 --> 00:08:41.320
<v Speaker 1>But why Yeah, what's the payoff?

179
00:08:41.600 --> 00:08:45.240
<v Speaker 2>It ensures the object maintains its integrity. The guide uses

180
00:08:45.240 --> 00:08:49.120
<v Speaker 2>a rectangle example. Say width is set externally, but height

181
00:08:49.200 --> 00:08:53.440
<v Speaker 2>is calculated internally. Maybe height with two. Okay, if height

182
00:08:53.480 --> 00:08:57.440
<v Speaker 2>were public, someone could set it directly, breaking that internal logic, right,

183
00:08:57.840 --> 00:08:59.679
<v Speaker 2>the rectangle wouldn't behave as intended.

184
00:09:00.039 --> 00:09:04.919
<v Speaker 1>Ah, So encapsulation protects the object's internal consistency exactly.

185
00:09:05.080 --> 00:09:08.320
<v Speaker 2>It lets the creator guarantee the object's behavior. Plus you

186
00:09:08.360 --> 00:09:11.440
<v Speaker 2>can change the internal implementation later, maybe optimize how height

187
00:09:11.519 --> 00:09:14.120
<v Speaker 2>is calculated and as long as the public methods don't change,

188
00:09:14.200 --> 00:09:16.600
<v Speaker 2>nothing outside breaks. That's huge for maintenance.

189
00:09:16.720 --> 00:09:19.360
<v Speaker 1>That makes sense, and that idea of how components interact

190
00:09:19.519 --> 00:09:22.480
<v Speaker 1>leads us straight to coupling, doesn't it tight versus loose?

191
00:09:22.639 --> 00:09:24.799
<v Speaker 2>Right? A really important concept for a larger systems.

192
00:09:24.879 --> 00:09:25.639
<v Speaker 1>So take coupling.

193
00:09:26.200 --> 00:09:29.679
<v Speaker 2>That's bad generally, yes, it means components are too dependent.

194
00:09:30.159 --> 00:09:33.679
<v Speaker 2>If class A directly creates and calls methods on class B,

195
00:09:34.120 --> 00:09:36.679
<v Speaker 2>a change in B, like renaming a method, breaks A.

196
00:09:37.440 --> 00:09:39.799
<v Speaker 2>It creates ripples. Maintenance becomes a nightmare.

197
00:09:39.879 --> 00:09:42.440
<v Speaker 1>Okay, So loose coupling is the goal. How does that work?

198
00:09:42.679 --> 00:09:46.240
<v Speaker 2>With loose coupling components are independent. Class A might rely

199
00:09:46.320 --> 00:09:49.039
<v Speaker 2>on an interface, let's say print, Then class B and

200
00:09:49.120 --> 00:09:52.639
<v Speaker 2>class C can implement print. A just interacts with the

201
00:09:52.639 --> 00:09:54.320
<v Speaker 2>print interface, not B or C.

202
00:09:54.399 --> 00:09:56.360
<v Speaker 1>Directly, so A doesn't care if it's B or C

203
00:09:56.600 --> 00:09:57.879
<v Speaker 1>doing the printing exactly.

204
00:09:58.240 --> 00:10:00.799
<v Speaker 2>You can swap B for C without changing A. It

205
00:10:00.840 --> 00:10:03.919
<v Speaker 2>gives you flexibility, makes the system easier to change and extend,

206
00:10:04.440 --> 00:10:05.840
<v Speaker 2>vital for complex software.

207
00:10:06.000 --> 00:10:10.159
<v Speaker 1>Makes perfect sense. Now, another classic OP interview question, abstract

208
00:10:10.200 --> 00:10:14.320
<v Speaker 1>classes versus interfaces. What's the quick takeaway on when to use.

209
00:10:14.200 --> 00:10:18.200
<v Speaker 2>Which key differences boil down to capabilities. An abstract class

210
00:10:18.240 --> 00:10:21.399
<v Speaker 2>can have both abstract methods to be implemented by subclasses

211
00:10:21.639 --> 00:10:25.879
<v Speaker 2>and concrete methods with implementation. It can have constructors data members,

212
00:10:26.080 --> 00:10:28.759
<v Speaker 2>but Java only allows single inheritance from classes.

213
00:10:28.840 --> 00:10:31.480
<v Speaker 1>Okay, so partial implementation possible, right.

214
00:10:31.840 --> 00:10:35.559
<v Speaker 2>An interface traditionally only had abstract methods, though Java eight

215
00:10:35.600 --> 00:10:39.120
<v Speaker 2>added default and static methods, blurring the lines a bit. Yeah, no,

216
00:10:39.279 --> 00:10:43.960
<v Speaker 2>constructors can only declare constants. But crucially, a class can

217
00:10:44.000 --> 00:10:45.159
<v Speaker 2>implement multiple.

218
00:10:44.840 --> 00:10:47.480
<v Speaker 1>Interfaces multiple inheritance of type exactly.

219
00:10:47.559 --> 00:10:51.240
<v Speaker 2>So abstract classes are often for is I relationships where

220
00:10:51.240 --> 00:10:54.399
<v Speaker 2>you want to provide some base implementation interfaces. Define it

221
00:10:54.440 --> 00:10:56.320
<v Speaker 2>can do contract or capability.

222
00:10:56.440 --> 00:10:59.679
<v Speaker 1>Got it. Then there's polymorphism, the idea that you can

223
00:10:59.720 --> 00:11:03.399
<v Speaker 1>refer to an object via its superclass or interface type.

224
00:11:03.919 --> 00:11:08.080
<v Speaker 1>But the guide warns about a cosmic superclass. Payfall, what's

225
00:11:08.120 --> 00:11:08.879
<v Speaker 1>that right?

226
00:11:09.000 --> 00:11:12.919
<v Speaker 2>So technically every object in Java inherits from the object class.

227
00:11:13.320 --> 00:11:15.759
<v Speaker 2>You can refer to any object using a variable.

228
00:11:15.440 --> 00:11:17.480
<v Speaker 1>Of type object the cosmic superclass.

229
00:11:17.559 --> 00:11:20.720
<v Speaker 2>Yeah, but it's usually impractical. If your variable is type object,

230
00:11:20.759 --> 00:11:23.159
<v Speaker 2>you can only call methods defined in the object class itself,

231
00:11:23.200 --> 00:11:25.000
<v Speaker 2>like equals hash code.

232
00:11:24.799 --> 00:11:27.639
<v Speaker 1>To string, you lose access to all the specific methods

233
00:11:27.679 --> 00:11:28.679
<v Speaker 1>of the actual object.

234
00:11:29.000 --> 00:11:31.919
<v Speaker 2>Precisely, you'd have to cast it back to its real

235
00:11:31.960 --> 00:11:34.720
<v Speaker 2>type to do anything useful, which can lead to class

236
00:11:34.759 --> 00:11:39.559
<v Speaker 2>gass exceptions if you're not careful. So, while technically correct,

237
00:11:40.000 --> 00:11:43.399
<v Speaker 2>referring to everything as object severely limits what you can

238
00:11:43.440 --> 00:11:45.399
<v Speaker 2>do and often isn't good design.

239
00:11:45.639 --> 00:11:48.879
<v Speaker 1>A good warning before we move to concurrency. Quick hits

240
00:11:49.240 --> 00:11:53.200
<v Speaker 1>wrapper classes and immutability wrapper classes.

241
00:11:52.759 --> 00:11:57.519
<v Speaker 2>Super concept object versions of primitives. It becomes integer, boolean

242
00:11:57.559 --> 00:12:01.039
<v Speaker 2>becomes boolean, et cetera. Main uses are in collections like

243
00:12:01.080 --> 00:12:04.240
<v Speaker 2>a ray list, which can only store objects, not primitives,

244
00:12:04.600 --> 00:12:05.960
<v Speaker 2>and for parsing strings to.

245
00:12:05.879 --> 00:12:09.000
<v Speaker 1>Primitive types and the auto boxing boxing.

246
00:12:08.720 --> 00:12:12.759
<v Speaker 2>Just syntactic sugar. The compiler automatically converts between primitives and

247
00:12:12.799 --> 00:12:16.879
<v Speaker 2>rappers when needed. Like adding two inteture objects under the hood,

248
00:12:16.919 --> 00:12:19.480
<v Speaker 2>it's unboxing them to ends, doing the math, and maybe

249
00:12:19.480 --> 00:12:20.519
<v Speaker 2>boxing the result back.

250
00:12:20.639 --> 00:12:24.480
<v Speaker 1>Convenient and immutable objects like string, why are they important?

251
00:12:24.639 --> 00:12:28.039
<v Speaker 2>Immutability meaning the object state can't be changed after it's created,

252
00:12:28.120 --> 00:12:32.000
<v Speaker 2>is super important for a couple of reasons, primarily thread safety.

253
00:12:32.559 --> 00:12:35.240
<v Speaker 2>If an object can't change, it can be shared safely

254
00:12:35.279 --> 00:12:39.200
<v Speaker 2>between multiple threads without any need for synchronization, no race

255
00:12:39.240 --> 00:12:41.120
<v Speaker 2>conditions possible on its state. Ah.

256
00:12:41.279 --> 00:12:43.559
<v Speaker 1>That simplifies concurrent programming.

257
00:12:43.240 --> 00:12:48.200
<v Speaker 2>Massively and predictability. You know that once created, its value

258
00:12:48.279 --> 00:12:52.080
<v Speaker 2>won't unexpectedly change somewhere else in the code. String is

259
00:12:52.120 --> 00:12:56.200
<v Speaker 2>the classic example. All string operations create new string objects.

260
00:12:56.320 --> 00:13:00.279
<v Speaker 1>Okay, that's a perfect lead in to concurrency itself. Managing

261
00:13:00.360 --> 00:13:05.240
<v Speaker 1>multiple threads doing things at once foundational concept multi threading, Right.

262
00:13:05.279 --> 00:13:08.919
<v Speaker 2>It's about having multiple threads of execution running seemingly simultaneously

263
00:13:08.960 --> 00:13:12.720
<v Speaker 2>within one program one process, and the main benefit performance

264
00:13:12.759 --> 00:13:16.519
<v Speaker 2>and responsiveness. Threads are lighter than full processes share memory,

265
00:13:16.679 --> 00:13:19.080
<v Speaker 2>so you can break tasks down, run them in parallel,

266
00:13:19.279 --> 00:13:22.799
<v Speaker 2>utilize multiple CPU cores, and keep the application responsive, especially

267
00:13:22.840 --> 00:13:23.320
<v Speaker 2>the UI.

268
00:13:23.399 --> 00:13:27.960
<v Speaker 1>Gotcha, Now a really critical interview question, Wait versus sleep?

269
00:13:27.960 --> 00:13:30.320
<v Speaker 1>They found similar, but they're fundamentally different.

270
00:13:30.120 --> 00:13:33.000
<v Speaker 2>Right, absolute fundamental difference. This trips up so many people.

271
00:13:33.039 --> 00:13:33.480
<v Speaker 1>What is it?

272
00:13:33.720 --> 00:13:36.399
<v Speaker 2>The key is the lock. When a thread is inside

273
00:13:36.399 --> 00:13:39.480
<v Speaker 2>a synchronized block or method, it holds a monitor lock.

274
00:13:39.960 --> 00:13:42.879
<v Speaker 2>If that thread calls weight, which is a method on

275
00:13:42.919 --> 00:13:45.440
<v Speaker 2>the object class, it releases the lock and goes into

276
00:13:45.480 --> 00:13:49.000
<v Speaker 2>a waiting state. This allows another thread to acquire the

277
00:13:49.039 --> 00:13:52.480
<v Speaker 2>lock and enter the synchronized section, maybe change the condition

278
00:13:52.519 --> 00:13:53.759
<v Speaker 2>the first thread was waiting for.

279
00:13:54.360 --> 00:13:56.600
<v Speaker 1>So wait, let's others in what about sleep?

280
00:13:56.919 --> 00:13:59.440
<v Speaker 2>Sleep, which is a static method on the thread class,

281
00:13:59.759 --> 00:14:03.440
<v Speaker 2>does not release the lock. The thread just pauses execution

282
00:14:03.480 --> 00:14:06.399
<v Speaker 2>for a specified time, but it continues to hold on

283
00:14:06.440 --> 00:14:07.320
<v Speaker 2>to any locks.

284
00:14:07.039 --> 00:14:10.200
<v Speaker 1>It acquired, so it blocks others while it naps.

285
00:14:10.399 --> 00:14:14.600
<v Speaker 2>Exactly, Wait is for interthread communication and coordination based on conditions.

286
00:14:15.320 --> 00:14:20.360
<v Speaker 2>Sleep is just pausing execution. Huge difference in concurrent design.

287
00:14:20.159 --> 00:14:23.320
<v Speaker 1>That's crystal clear. So wait relies on synchronization. What's the

288
00:14:23.320 --> 00:14:25.480
<v Speaker 1>core idea behind synchronization itself.

289
00:14:25.600 --> 00:14:29.440
<v Speaker 2>It's all about controlling access to shared resources data objects

290
00:14:29.480 --> 00:14:31.799
<v Speaker 2>when multiple thread might try to modify them at the same.

291
00:14:31.600 --> 00:14:33.240
<v Speaker 1>Time, preventing chaos.

292
00:14:32.879 --> 00:14:38.240
<v Speaker 2>Pretty much, preventing race conditions, ensuring data consistency. Using the

293
00:14:38.240 --> 00:14:41.000
<v Speaker 2>synchronized keyword on a method or a block of code

294
00:14:41.360 --> 00:14:44.320
<v Speaker 2>ensures that only one thread can execute that critical section

295
00:14:44.360 --> 00:14:47.240
<v Speaker 2>at any given time. It enforces mutual exclusion.

296
00:14:47.320 --> 00:14:50.360
<v Speaker 1>But if you're not careful with locks, you can get

297
00:14:50.360 --> 00:14:51.000
<v Speaker 1>into trouble.

298
00:14:51.279 --> 00:14:54.639
<v Speaker 2>Deadlock the dreaded deadlock. Yeah, it's when two or more

299
00:14:54.720 --> 00:14:57.279
<v Speaker 2>threads are stuck waiting for each other indefinitely.

300
00:14:57.440 --> 00:14:58.440
<v Speaker 1>How does that happen?

301
00:14:58.639 --> 00:15:01.879
<v Speaker 2>Typically, thread A holds lock one and is waiting for

302
00:15:01.919 --> 00:15:05.240
<v Speaker 2>lock two, while thread B holds lock two and is

303
00:15:05.279 --> 00:15:08.639
<v Speaker 2>waiting for lock one. Neither can proceed. It's a standstill.

304
00:15:08.679 --> 00:15:11.279
<v Speaker 1>How do you deal with that? Detection avoidance.

305
00:15:11.679 --> 00:15:14.120
<v Speaker 2>You can detect them using thread dumps, which show the

306
00:15:14.159 --> 00:15:16.480
<v Speaker 2>state of all threads and the locks they hold, but

307
00:15:16.559 --> 00:15:17.639
<v Speaker 2>avoidance is much better.

308
00:15:17.759 --> 00:15:18.480
<v Speaker 1>Strategies.

309
00:15:18.679 --> 00:15:22.559
<v Speaker 2>The guide suggests things like avoid acquiring multiple locks if possible,

310
00:15:22.679 --> 00:15:25.399
<v Speaker 2>nested locks if you must, always acquire them in the

311
00:15:25.440 --> 00:15:29.759
<v Speaker 2>same global order. Don't hold locks longer than necessary. Consider

312
00:15:29.840 --> 00:15:32.440
<v Speaker 2>using thread dot join to wait for another thread without

313
00:15:32.480 --> 00:15:33.840
<v Speaker 2>holding inappropriate locks.

314
00:15:34.200 --> 00:15:38.200
<v Speaker 1>Careful design is key beyond synchronized. What about volatile and

315
00:15:38.279 --> 00:15:41.120
<v Speaker 1>thread local for thread safety two different tools.

316
00:15:42.080 --> 00:15:46.440
<v Speaker 2>Volatile primarily addresses visibility. It guarantees that rights to a

317
00:15:46.519 --> 00:15:50.080
<v Speaker 2>volatle variable by one thread are immediately visible to other threads.

318
00:15:50.519 --> 00:15:53.519
<v Speaker 2>It prevents problems with cached variable values in different CPU

319
00:15:53.639 --> 00:15:57.000
<v Speaker 2>core so everyone sees the latest value right. Thread local

320
00:15:57.000 --> 00:16:01.639
<v Speaker 2>tackles concurrency differently. It eliminates sharing. It provides each thread

321
00:16:01.639 --> 00:16:03.960
<v Speaker 2>with its own independent copy of a variable.

322
00:16:04.080 --> 00:16:05.960
<v Speaker 1>No sharing, no conflict exactly.

323
00:16:06.039 --> 00:16:08.519
<v Speaker 2>Since each thread has its own instance, there's no need

324
00:16:08.559 --> 00:16:12.120
<v Speaker 2>for synchronization to access it. Great for things like user

325
00:16:12.159 --> 00:16:17.360
<v Speaker 2>sessions or transaction contexts, improving scalability by avoiding synchronization bottlenecks.

326
00:16:17.360 --> 00:16:20.440
<v Speaker 1>Okay, that covers classic and currency. Let's jump to more

327
00:16:20.440 --> 00:16:24.799
<v Speaker 1>modern Java eight onwards. Big changes with functional programming and

328
00:16:24.840 --> 00:16:26.840
<v Speaker 1>the stream API. Why that shift?

329
00:16:27.120 --> 00:16:29.759
<v Speaker 2>It was really driven by the need for better ways

330
00:16:29.799 --> 00:16:34.039
<v Speaker 2>to handle collections and data processing, especially with multiicore processors

331
00:16:34.080 --> 00:16:34.919
<v Speaker 2>becoming standard.

332
00:16:35.240 --> 00:16:37.360
<v Speaker 1>Moving away from traditional loops YEA.

333
00:16:37.320 --> 00:16:41.039
<v Speaker 2>And moving away from verbose imperative loops. The how to

334
00:16:41.120 --> 00:16:45.399
<v Speaker 2>a more declarative style? The what functional programming concepts like

335
00:16:45.440 --> 00:16:50.279
<v Speaker 2>immutability and avoiding side effects may parallel processing easier and

336
00:16:50.440 --> 00:16:54.120
<v Speaker 2>code often more concise and readable. It addressed the vertical

337
00:16:54.159 --> 00:16:56.759
<v Speaker 2>problem of deeply nested anonymous inner.

338
00:16:56.559 --> 00:16:59.320
<v Speaker 1>Classes too, and the stream API is the main tool

339
00:16:59.360 --> 00:16:59.639
<v Speaker 1>for this.

340
00:16:59.840 --> 00:17:04.119
<v Speaker 2>It's the cornerstone. Yeah. Streams provide a fluent, pipeline based

341
00:17:04.119 --> 00:17:06.200
<v Speaker 2>way to process sequences of elements.

342
00:17:06.640 --> 00:17:08.799
<v Speaker 1>What are the advantages? Why use streams?

343
00:17:09.240 --> 00:17:14.119
<v Speaker 2>Several reasons. Functional style makes aggregate operations like some average

344
00:17:14.160 --> 00:17:17.960
<v Speaker 2>collect very clean, can lead to faster processing, especially with

345
00:17:18.039 --> 00:17:21.119
<v Speaker 2>parallel streams which leverage multi threading automatically.

346
00:17:21.319 --> 00:17:25.000
<v Speaker 1>You mentioned intermediate internal operations. How do they work and

347
00:17:25.079 --> 00:17:27.240
<v Speaker 1>this idea of laziness.

348
00:17:26.839 --> 00:17:31.079
<v Speaker 2>Right, stream operations are chained together. Intermediate operations like filter, map,

349
00:17:31.200 --> 00:17:35.160
<v Speaker 2>distinct limit are lazy, meaning they don't actually do anything

350
00:17:35.160 --> 00:17:36.839
<v Speaker 2>when you call them. They just set up the step

351
00:17:36.839 --> 00:17:39.400
<v Speaker 2>in the processing pipeline. They return a new stream.

352
00:17:39.440 --> 00:17:40.440
<v Speaker 1>Okay, so nothing happens.

353
00:17:40.519 --> 00:17:44.720
<v Speaker 2>Yet, nothing happens until a terminal operation is called. That's

354
00:17:44.799 --> 00:17:49.279
<v Speaker 2>things like four each collect min max reduce fine. First.

355
00:17:49.960 --> 00:17:53.559
<v Speaker 2>Internal operations kick off the processing the pipeline and consume

356
00:17:53.599 --> 00:17:56.359
<v Speaker 2>the stream. They produce a result or a side.

357
00:17:56.160 --> 00:17:59.960
<v Speaker 1>Effect, and the laziness part is the efficiency game exactly.

358
00:18:00.279 --> 00:18:03.680
<v Speaker 2>This is key because processing only starts at the terminal operation,

359
00:18:04.200 --> 00:18:07.119
<v Speaker 2>the stream can optimize. If you have a stream pipeline

360
00:18:07.240 --> 00:18:10.519
<v Speaker 2>like filter dot map dot find first, it won't necessarily

361
00:18:10.519 --> 00:18:13.880
<v Speaker 2>filter and map the entire collection. It will process elements

362
00:18:13.920 --> 00:18:16.960
<v Speaker 2>one by one through the pipeline just until it finds

363
00:18:16.960 --> 00:18:19.920
<v Speaker 2>the first element that satisfies the filter. Then it stops.

364
00:18:20.400 --> 00:18:23.480
<v Speaker 2>Huge performance benefit for large data sets or certain operations.

365
00:18:23.599 --> 00:18:28.160
<v Speaker 1>That's clever. Another common stream distinction map versus flatMap. What's

366
00:18:28.160 --> 00:18:28.920
<v Speaker 1>the difference is for.

367
00:18:28.839 --> 00:18:31.279
<v Speaker 2>A one to one transformation. You apply a function to

368
00:18:31.319 --> 00:18:33.759
<v Speaker 2>each element and you get one result element back for

369
00:18:33.799 --> 00:18:36.640
<v Speaker 2>each input element. Like converting a list string to a

370
00:18:36.680 --> 00:18:39.359
<v Speaker 2>list syeneger containing the links of the strings one string

371
00:18:39.400 --> 00:18:40.400
<v Speaker 2>in one itager.

372
00:18:40.119 --> 00:18:42.160
<v Speaker 1>Out straightforward transformation right.

373
00:18:42.279 --> 00:18:46.039
<v Speaker 2>flatMap is different. It's used when your mapping function returns

374
00:18:46.039 --> 00:18:48.519
<v Speaker 2>the stream for each element and you want to flatten

375
00:18:48.559 --> 00:18:51.680
<v Speaker 2>all those resulting streams into a single combined stream.

376
00:18:51.799 --> 00:18:52.279
<v Speaker 1>Example.

377
00:18:52.640 --> 00:18:55.759
<v Speaker 2>Imagine you have a listless integer a list of lists.

378
00:18:56.119 --> 00:18:58.160
<v Speaker 2>If you just map it, you'd get a streamless senature.

379
00:18:58.599 --> 00:19:00.839
<v Speaker 2>But if you flat map it using a function that

380
00:19:00.920 --> 00:19:05.200
<v Speaker 2>just returns the inter list as a stream list dot stream,

381
00:19:05.640 --> 00:19:08.119
<v Speaker 2>you end up with a single stream nager containing all

382
00:19:08.160 --> 00:19:11.559
<v Speaker 2>the integers from all the inter lists. It flattens the structure.

383
00:19:11.680 --> 00:19:15.039
<v Speaker 1>Okay, flattened streams of streams got it and parallel streams

384
00:19:15.279 --> 00:19:17.160
<v Speaker 1>leveraging multiple cores YEP, which.

385
00:19:17.039 --> 00:19:19.440
<v Speaker 2>Is called dot parallel stream instead of dot stream or

386
00:19:19.720 --> 00:19:23.799
<v Speaker 2>parallel on an existing stream. Java handles splitting the work

387
00:19:23.839 --> 00:19:26.640
<v Speaker 2>across multiple threads using the common fork joint pool.

388
00:19:26.759 --> 00:19:27.640
<v Speaker 1>But there's a catch.

389
00:19:27.720 --> 00:19:29.759
<v Speaker 2>The main catch is that the order of elements is

390
00:19:29.799 --> 00:19:33.759
<v Speaker 2>not guaranteed during parallel processing because different threads might finish

391
00:19:33.759 --> 00:19:36.799
<v Speaker 2>processing different chunks out of order, so if the dequence matters,

392
00:19:36.960 --> 00:19:39.559
<v Speaker 2>parallel streams might not be suitable, or you need to

393
00:19:39.559 --> 00:19:41.119
<v Speaker 2>handle ordering carefully afterwards.

394
00:19:41.240 --> 00:19:45.240
<v Speaker 1>Get to know. Finally, for modern Java features, the optional

395
00:19:45.279 --> 00:19:47.319
<v Speaker 1>class introduced to fight.

396
00:19:47.440 --> 00:19:49.480
<v Speaker 2>The dreaded null pointer exception.

397
00:19:49.240 --> 00:19:50.519
<v Speaker 1>The billion dollar mistake.

398
00:19:50.640 --> 00:19:54.039
<v Speaker 2>Indeed, optional is basically a container object that may or

399
00:19:54.079 --> 00:19:55.799
<v Speaker 2>may not contain a non null value.

400
00:19:55.920 --> 00:19:58.640
<v Speaker 1>So it's like a box that might be empty exactly.

401
00:19:59.039 --> 00:20:01.400
<v Speaker 2>Instead of returning null from a method when a value

402
00:20:01.519 --> 00:20:04.559
<v Speaker 2>might be absent, you return and optional. The caller is

403
00:20:04.599 --> 00:20:07.920
<v Speaker 2>then forced to consciously deal with the possibility of absences

404
00:20:08.400 --> 00:20:12.119
<v Speaker 2>using methods like is present, or provide a default value

405
00:20:12.240 --> 00:20:14.559
<v Speaker 2>or else, throw, throw an exception, et cetera.

406
00:20:14.799 --> 00:20:17.759
<v Speaker 1>Makes the possibility explicit, right, it makes the code more

407
00:20:17.839 --> 00:20:21.640
<v Speaker 1>robust and self documenting about potential knulls a big improvement.

408
00:20:21.680 --> 00:20:25.839
<v Speaker 1>What a journey through Java's evolution? Okay, let's shift to

409
00:20:25.960 --> 00:20:30.000
<v Speaker 1>managing groups of objects. The collections framework. Why is it

410
00:20:30.039 --> 00:20:30.640
<v Speaker 1>so central?

411
00:20:30.920 --> 00:20:34.240
<v Speaker 2>It's fundamental because it provides standardized, efficient ways to store

412
00:20:34.319 --> 00:20:39.119
<v Speaker 2>and manipulate groups of objects. Think lists, sets, maps, benefits,

413
00:20:39.400 --> 00:20:42.480
<v Speaker 2>reduces development effort. You don't have to reinvent these data structures,

414
00:20:42.960 --> 00:20:46.880
<v Speaker 2>enhances code quality. These implementations are highly optimized and tested,

415
00:20:47.279 --> 00:20:52.519
<v Speaker 2>promotes reusability and interoperability. Everyone uses the same interfaces. List

416
00:20:52.640 --> 00:20:53.440
<v Speaker 2>set map.

417
00:20:53.440 --> 00:20:58.000
<v Speaker 1>A basic comparison first standard array versus a collection.

418
00:20:58.039 --> 00:21:01.440
<v Speaker 2>Like ray list key differences. Arrays have a fixed size

419
00:21:01.440 --> 00:21:06.319
<v Speaker 2>decided at creation. Collections are dynamically sized. Arrays can hold primitives,

420
00:21:06.480 --> 00:21:12.119
<v Speaker 2>int float and objects. Collections pre generics aside hold only

421
00:21:12.200 --> 00:21:15.079
<v Speaker 2>objects using rappers for primitives okay.

422
00:21:15.039 --> 00:21:19.240
<v Speaker 1>And within collections. A raylist versus link list a common choice.

423
00:21:19.359 --> 00:21:22.759
<v Speaker 2>The difference is their internal structure and the resulting performance

424
00:21:22.839 --> 00:21:25.960
<v Speaker 2>trade offs. A ray list uses an underlying dynamic array,

425
00:21:26.079 --> 00:21:29.200
<v Speaker 2>so good for great for storing elements and fast random

426
00:21:29.200 --> 00:21:32.640
<v Speaker 2>access getting element using getties very quick, but adding or

427
00:21:32.680 --> 00:21:35.839
<v Speaker 2>removing elements in the middle can be slow because it

428
00:21:35.920 --> 00:21:37.839
<v Speaker 2>might involve shifting subsequent.

429
00:21:37.359 --> 00:21:38.440
<v Speaker 1>Elements and link lists.

430
00:21:38.440 --> 00:21:41.400
<v Speaker 2>It's a doubly linked list. Each element holds pointers to

431
00:21:41.440 --> 00:21:44.000
<v Speaker 2>the next and previous element, making it good for much

432
00:21:44.039 --> 00:21:46.559
<v Speaker 2>faster for adding or removing elements, especially in the middle

433
00:21:46.559 --> 00:21:49.640
<v Speaker 2>because it just involves updating pointers. But random access is

434
00:21:49.680 --> 00:21:51.759
<v Speaker 2>slower because it might have to traverse the list from

435
00:21:51.759 --> 00:21:52.480
<v Speaker 2>the beginning.

436
00:21:52.240 --> 00:21:55.480
<v Speaker 1>Or end, so trade off fast access array list versus

437
00:21:55.480 --> 00:21:57.240
<v Speaker 1>fast insertion dilation link list.

438
00:21:57.640 --> 00:22:00.839
<v Speaker 2>Generally yes, depends on your prime use case.

439
00:22:01.119 --> 00:22:04.440
<v Speaker 1>Now here's a really crucial point. The guide hammer's home

440
00:22:04.680 --> 00:22:11.200
<v Speaker 1>a major potential pitfall implementing hash code and equals. Why

441
00:22:11.319 --> 00:22:14.039
<v Speaker 1>is getting both rights so critical for things like hash

442
00:22:14.160 --> 00:22:15.039
<v Speaker 1>map and hash set?

443
00:22:15.160 --> 00:22:17.880
<v Speaker 2>Oh, this is absolutely critical. It's probably one of the

444
00:22:17.920 --> 00:22:21.200
<v Speaker 2>most common sources of subtle bugs when working with collections.

445
00:22:21.279 --> 00:22:22.200
<v Speaker 1>Why what do they do?

446
00:22:22.400 --> 00:22:25.400
<v Speaker 2>Hash set needs to quickly determine if an element already exists.

447
00:22:25.799 --> 00:22:28.119
<v Speaker 2>Hashmap needs to quickly find the bucket where a key

448
00:22:28.200 --> 00:22:31.319
<v Speaker 2>value pair should be stored or retrieved. They both rely

449
00:22:31.440 --> 00:22:34.240
<v Speaker 2>on hash code first to narrow down the possibilities, and

450
00:22:34.319 --> 00:22:37.680
<v Speaker 2>then equals to confirm an exact match within that narrow

451
00:22:37.759 --> 00:22:38.640
<v Speaker 2>set or bucket.

452
00:22:38.720 --> 00:22:39.640
<v Speaker 1>So they work together.

453
00:22:39.720 --> 00:22:42.880
<v Speaker 2>They must work together according to a specific contract. The

454
00:22:42.920 --> 00:22:46.079
<v Speaker 2>contract is if two objects are considered equal according to

455
00:22:46.119 --> 00:22:49.599
<v Speaker 2>their equals method, then they must produce the same integer

456
00:22:49.640 --> 00:22:51.200
<v Speaker 2>result when their hash code method.

457
00:22:51.039 --> 00:22:53.720
<v Speaker 1>Is called equal. Objects must have equal hash codes. What

458
00:22:53.839 --> 00:22:56.000
<v Speaker 1>happens if you break that contract.

459
00:22:55.680 --> 00:22:59.160
<v Speaker 2>All sorts of weird behavior. If you override equals but

460
00:22:59.240 --> 00:23:02.799
<v Speaker 2>not hash code, two objects you consider equal might end

461
00:23:02.880 --> 00:23:05.039
<v Speaker 2>up in different buckets. In a hash map or hash set,

462
00:23:05.880 --> 00:23:08.920
<v Speaker 2>the collection won't find the object, even if it's logically there.

463
00:23:09.319 --> 00:23:12.359
<v Speaker 2>You might store duplicates in the set in tains or

464
00:23:12.480 --> 00:23:15.200
<v Speaker 2>get might return false when it should be true.

465
00:23:15.400 --> 00:23:17.559
<v Speaker 1>Nightmare. The guide gives an employee example.

466
00:23:17.599 --> 00:23:20.480
<v Speaker 2>Right yeah, like if equals checks employee, but hash code

467
00:23:20.519 --> 00:23:23.680
<v Speaker 2>uses the default object hash code based on memory address.

468
00:23:24.039 --> 00:23:26.400
<v Speaker 2>Two employee objects with the same ID won't have the

469
00:23:26.440 --> 00:23:29.480
<v Speaker 2>same hash code. Your set won't work correctly. Map dot

470
00:23:29.519 --> 00:23:32.519
<v Speaker 2>get will fail. You must override both consistently.

471
00:23:32.799 --> 00:23:36.000
<v Speaker 1>That's a fantastic explanation of the why. Okay, building on

472
00:23:36.039 --> 00:23:40.960
<v Speaker 1>solid foundations, let's talk design patterns reusable solutions. Advantages seem clear,

473
00:23:41.279 --> 00:23:42.440
<v Speaker 1>but any downsides.

474
00:23:42.559 --> 00:23:46.720
<v Speaker 2>Patterns are great reusable templates, defining architecture, capturing expertise, but

475
00:23:46.759 --> 00:23:49.240
<v Speaker 2>they're not silver bullets. Well, they don't give you direct

476
00:23:49.319 --> 00:23:52.920
<v Speaker 2>code reuse, just a concept. They can seem simple but

477
00:23:53.000 --> 00:23:57.160
<v Speaker 2>be tricky to implement correctly, leading to misuse, and sometimes

478
00:23:57.200 --> 00:24:00.599
<v Speaker 2>teams suffer from pattern overload, trying to force everything into

479
00:24:00.640 --> 00:24:03.839
<v Speaker 2>a pattern when a simpler approach would do. Knowing when

480
00:24:03.880 --> 00:24:06.039
<v Speaker 2>and why is as important.

481
00:24:05.640 --> 00:24:08.440
<v Speaker 1>As how makes sense. Let's touch on a few key

482
00:24:08.519 --> 00:24:12.920
<v Speaker 1>patterns often asked about singleton ensuring just one instance right.

483
00:24:13.079 --> 00:24:16.440
<v Speaker 2>Classic pattern usually done with a private constructor and a

484
00:24:16.480 --> 00:24:20.279
<v Speaker 2>public static method that returns the single instances. Implementation styles

485
00:24:20.359 --> 00:24:23.039
<v Speaker 2>you can create the instance eagerly when the class loads,

486
00:24:23.160 --> 00:24:26.440
<v Speaker 2>or lazily the first time it's requested. Lazy needs care

487
00:24:26.519 --> 00:24:30.480
<v Speaker 2>with thread safety using synchronized double checked locking, or often

488
00:24:30.480 --> 00:24:33.599
<v Speaker 2>the neatest way using an NM or a static inner helper.

489
00:24:33.359 --> 00:24:36.759
<v Speaker 1>Class GdK example runtime, dot get run time. Okay, how

490
00:24:36.799 --> 00:24:39.799
<v Speaker 1>about the factory patterns, simple factory and abstract factory.

491
00:24:39.880 --> 00:24:43.839
<v Speaker 2>The basic factory pattern hides object creation logic. You ask

492
00:24:43.839 --> 00:24:46.400
<v Speaker 2>a factory object for an object, maybe specifying a type,

493
00:24:46.480 --> 00:24:48.240
<v Speaker 2>and it gives you back an instance without you needing

494
00:24:48.240 --> 00:24:51.920
<v Speaker 2>to know the specific constructor details. It decouples creation from usage.

495
00:24:51.960 --> 00:24:54.119
<v Speaker 1>And abstract factory that's.

496
00:24:53.920 --> 00:24:56.640
<v Speaker 2>A step up of factory of factories. It's designed to

497
00:24:56.680 --> 00:25:00.160
<v Speaker 2>create families of related or dependent objects without stetify ying

498
00:25:00.200 --> 00:25:05.000
<v Speaker 2>their concrete classes. Think creating UY elements for different operating systems.

499
00:25:05.480 --> 00:25:09.039
<v Speaker 2>An abstract factory could create Windows buttons and scroll bars,

500
00:25:09.160 --> 00:25:11.799
<v Speaker 2>while another creates Mac buttons and scroll bars, all through

501
00:25:11.839 --> 00:25:13.319
<v Speaker 2>the same abstract interface.

502
00:25:13.559 --> 00:25:18.079
<v Speaker 1>So single object type versus families of related objects exactly

503
00:25:18.119 --> 00:25:22.079
<v Speaker 1>and quickly. Three more that sometimes get confused Decorator, Proxy Adapter.

504
00:25:22.319 --> 00:25:23.599
<v Speaker 1>Their distinct goals.

505
00:25:23.519 --> 00:25:27.839
<v Speaker 2>All involve wrapping objects, but for different reasons. Decorator adds

506
00:25:27.880 --> 00:25:31.839
<v Speaker 2>responsibilities to an object dynamically. Think wrapping a file input

507
00:25:31.839 --> 00:25:35.400
<v Speaker 2>stream with a buffered input stream. To add buffering, same interface,

508
00:25:35.559 --> 00:25:37.240
<v Speaker 2>extra functionality.

509
00:25:36.640 --> 00:25:37.759
<v Speaker 1>Okay, adding features.

510
00:25:37.799 --> 00:25:41.480
<v Speaker 2>Proxy Proxy provides a surrogate or placeholder to control access

511
00:25:41.519 --> 00:25:44.799
<v Speaker 2>to another object. Use for things like lazy initialization, don't

512
00:25:44.839 --> 00:25:48.720
<v Speaker 2>create the real object until needed, access control logging. It

513
00:25:48.759 --> 00:25:50.839
<v Speaker 2>controls how or if you get to the real.

514
00:25:50.640 --> 00:25:52.839
<v Speaker 1>Object controlling access adapter.

515
00:25:53.319 --> 00:25:57.160
<v Speaker 2>Adapter makes two incompatible interfaces work together. It acts as

516
00:25:57.200 --> 00:25:59.559
<v Speaker 2>a bridge or translator. If you have a class that

517
00:25:59.599 --> 00:26:02.759
<v Speaker 2>expects interface X, but you have an object that implements

518
00:26:02.799 --> 00:26:06.039
<v Speaker 2>interface Y, and adapter implementing X can wrap the object

519
00:26:06.039 --> 00:26:07.599
<v Speaker 2>implementing Y translated the.

520
00:26:07.559 --> 00:26:10.960
<v Speaker 1>Calls translator got it and behind. Many good designs lie

521
00:26:10.960 --> 00:26:13.960
<v Speaker 1>the solid principles just the overall philosophy.

522
00:26:14.119 --> 00:26:18.680
<v Speaker 2>Solid principles single responsibility, open closed, lisk, go of substitution,

523
00:26:18.880 --> 00:26:24.359
<v Speaker 2>interface aggregation, dependency, inversion are guidelines for creating understandable, flexible,

524
00:26:24.680 --> 00:26:29.839
<v Speaker 2>maintainable object oriented designs like the open closed principle software

525
00:26:29.920 --> 00:26:33.000
<v Speaker 2>entities should be open for extension but closed for modification.

526
00:26:33.640 --> 00:26:36.799
<v Speaker 2>Add new features by adding new code, not changing existing

527
00:26:36.880 --> 00:26:40.000
<v Speaker 2>working code, they guide you towards better architecture. Wow.

528
00:26:40.119 --> 00:26:42.839
<v Speaker 1>Okay, we have covered an incredible amount of ground. From

529
00:26:42.920 --> 00:26:46.079
<v Speaker 1>really understanding the interview process itself, the human.

530
00:26:45.880 --> 00:26:48.519
<v Speaker 2>Side crucial first step to diving.

531
00:26:48.200 --> 00:26:51.880
<v Speaker 1>Deep into the JVM architecture, that bytecode verifyer, the nuances

532
00:26:51.920 --> 00:26:56.160
<v Speaker 1>of OOP like encapsulation and polymorphisms and hash code equals definitely,

533
00:26:56.480 --> 00:27:00.720
<v Speaker 1>Then tackling concurrency, weight versus sleep deadlocks, and the modern

534
00:27:00.799 --> 00:27:02.519
<v Speaker 1>functional approach with streams.

535
00:27:02.160 --> 00:27:04.319
<v Speaker 2>And optional Yeah. Lot packed in there, and.

536
00:27:04.279 --> 00:27:09.480
<v Speaker 1>Finally thinking strategically with collections and design patterns like Singleton, Factory, Decorator,

537
00:27:09.519 --> 00:27:13.759
<v Speaker 1>Proxy Adapter. It feels like this look at Mandardrug's guide

538
00:27:13.839 --> 00:27:15.519
<v Speaker 1>really gives you that holistic view.

539
00:27:15.920 --> 00:27:19.400
<v Speaker 2>It aims to yeah, not just discrete facts, but how they.

540
00:27:19.240 --> 00:27:22.759
<v Speaker 1>Connect, helping you go beyond just answering questions to really

541
00:27:22.839 --> 00:27:26.000
<v Speaker 1>understanding the concepts, which has to build confidence.

542
00:27:26.119 --> 00:27:28.200
<v Speaker 2>That's the core idea, understanding the why.

543
00:27:28.960 --> 00:27:31.440
<v Speaker 1>So we've covered a lot, giving you a strong foundation,

544
00:27:31.839 --> 00:27:34.559
<v Speaker 1>but maybe one final thought to leave you with. Okay,

545
00:27:34.960 --> 00:27:38.759
<v Speaker 1>Given how fast Java and its ecosystem evolve, new versions,

546
00:27:38.799 --> 00:27:42.319
<v Speaker 1>new frameworks, new ideas all the time, how might today's

547
00:27:42.400 --> 00:27:45.599
<v Speaker 1>best practices, maybe for thread safety, or even how we

548
00:27:45.640 --> 00:27:48.920
<v Speaker 1>apply these classic design patterns be challenged or I don't know,

549
00:27:49.000 --> 00:27:51.319
<v Speaker 1>redefined in the next say, five years.

550
00:27:51.440 --> 00:27:54.880
<v Speaker 2>That's a great question. Things are constantly shifting, project loom,

551
00:27:55.000 --> 00:27:57.440
<v Speaker 2>changing concurrency, new patterns emerging.

552
00:27:57.400 --> 00:28:00.640
<v Speaker 1>Exactly, And what does that constant change mean for how

553
00:28:00.720 --> 00:28:04.039
<v Speaker 1>we as developers need to approach learning? How do we

554
00:28:04.079 --> 00:28:06.519
<v Speaker 1>stay truly proficient when the ground keeps moving?

555
00:28:07.039 --> 00:28:11.000
<v Speaker 2>It means continuous learning isn't optional, right, It's fundamental being

556
00:28:11.039 --> 00:28:13.680
<v Speaker 2>able to adapt, think critically about why a new approach

557
00:28:13.720 --> 00:28:17.319
<v Speaker 2>is better, not just chasing the latest trend. That adaptability,

558
00:28:17.319 --> 00:28:20.079
<v Speaker 2>that critical thinking, that's probably the most valuable skill in

559
00:28:20.119 --> 00:28:20.680
<v Speaker 2>the long run.
