YouTube2Text

3-7 Years Interview Experience | Java | Spring Boot | Microservices | SQL | Nagarro — Transcript

by Insights Instructor · 4,646 words · 687 segments · language en · Watch on YouTube

Full transcript

  1. 0:01okay so in your spring boot
  2. 0:05application how do you manage the code
  3. 0:08coverage so what steps do you follow and
  4. 0:12what is code
  5. 0:14coverage yeah so whenever we write the
  6. 0:17test cases right so we see that how much
  7. 0:22the portion of the code is covered under
  8. 0:25that so uh code coverage is nothing but
  9. 0:30it shows the percentage of the code
  10. 0:33which is covered using the test case we
  11. 0:36have written so basically it reduces the
  12. 0:40chances of having bugs in the
  13. 0:43application by covering the maximum code
  14. 0:47so in my current organization we follow
  15. 0:51minimum 90% of the uh code coverage MH
  16. 0:55so in all the uh code check-ins we do so
  17. 1:00before that we make sure that the 90% of
  18. 1:04the code is uh covered M so uh for that
  19. 1:08we use uh
  20. 1:10eemma so that is the STS tool which we
  21. 1:14can integrate with the STS and it
  22. 1:17basically whatever the code is covered
  23. 1:19so that will come into green and the
  24. 1:22portion is not covered will be in the uh
  25. 1:25red and it will be yellow if it is
  26. 1:28partially covered so so under the hood
  27. 1:30it uses Joko this is how we follow the
  28. 1:34code coverage in our uh spring boot
  29. 1:38application okay okay okay so how do you
  30. 1:43perform testing in your spring boot
  31. 1:46application yeah so so the testing can
  32. 1:50be of many types it can be either you
  33. 1:53need testing it can be integration
  34. 1:56testing into in testing or it can be
  35. 1:59perform testing so whenever we do the
  36. 2:03unit testing in that case uh like we
  37. 2:06test the methods and classes like uh
  38. 2:11individually we have three layers in our
  39. 2:14spring boot application our controller
  40. 2:17uh service and repository layer so we
  41. 2:21write the separate uh test cases for
  42. 2:24these three and suppose uh we are
  43. 2:27testing the controller and uh that is
  44. 2:30calling the service from there right so
  45. 2:35we can uh mock that service so since we
  46. 2:38also do the unit testing for that
  47. 2:40service class as well so uh wherever it
  48. 2:43is calling uh another service or
  49. 2:48any um uh API call or any other calls
  50. 2:53are happening so those calls we can mock
  51. 2:56it and we can write the standard return
  52. 2:58of it and that return return we can
  53. 3:01assume that okay that actual uh actual
  54. 3:04call is being made and that is the
  55. 3:05response based on that response we can
  56. 3:08further proceed so that is how we do the
  57. 3:11unit testing so in integration testing
  58. 3:13we test like uh how different units or
  59. 3:18components they work together when we
  60. 3:20combine them so when they interact with
  61. 3:22each other then how they perform so that
  62. 3:25is what we say integration testing then
  63. 3:27in case of into end testing we test the
  64. 3:30whole application as a component and we
  65. 3:33see if that does not have any issue then
  66. 3:37we also do performance testing so we
  67. 3:40check whenever the huge load is there on
  68. 3:43the application then how it
  69. 3:45performs so that is also there so yeah
  70. 3:49this is how we do the testing okay so
  71. 3:53how you do performance testing so
  72. 3:55performance testing usually we don't do
  73. 3:59and test
  74. 4:00perform that testing so they uh normally
  75. 4:04use uh J meter and all so they do like
  76. 4:08load testing and stress testing all that
  77. 4:10they do but uh I have not worked much on
  78. 4:14it okay so how do you perform logging in
  79. 4:17your
  80. 4:18application yeah logging we perform
  81. 4:22using uh slf
  82. 4:254J so that we use for logging and uh
  83. 4:30uh we use
  84. 4:32lombok so using that uh we don't have
  85. 4:36to uh write so that can remove the bar
  86. 4:40plate code and we can simply use
  87. 4:43annotation uh like at the rate of uh
  88. 4:46self 4J and then simply we can give uh
  89. 4:50log. debug or whatever we want so we can
  90. 4:54simply give the logging related
  91. 4:56properties in uh application Properties
  92. 5:00or EML file so whatever the loging level
  93. 5:04is there that we can Define there and
  94. 5:06also whatever the log output format will
  95. 5:09be there so like with date month timings
  96. 5:13whatever so all those things we can
  97. 5:15mention in the properties orl file so
  98. 5:19yeah so that is how we do logging okay
  99. 5:22so how do you perform centralized
  100. 5:25logging in
  101. 5:27microservices yeah we use uh
  102. 5:30uh elk stack for
  103. 5:33that and for visualization we also use
  104. 5:38kibana okay so what are the different
  105. 5:40loging levels are
  106. 5:42there yeah so we have debug
  107. 5:46info uh warn error Trace fatle so yeah
  108. 5:54okay okay okay how do you maintain code
  109. 5:58quality in your project so what are the
  110. 6:00steps you follow yeah for code
  111. 6:03quality uh so we have a test cases right
  112. 6:08so we see the uh the coverage of that so
  113. 6:12that is one way then we have uh uh sonar
  114. 6:17lint sonar Cube so sonar lint basically
  115. 6:20we can integrate with our ID and we can
  116. 6:24get the real time feedback on if any
  117. 6:27code is uh like not written properly so
  118. 6:32any proper syntax we have not given and
  119. 6:34all right so those things we can find
  120. 6:38out so sonar CU we can use for that so
  121. 6:43it it
  122. 6:45basically uh connects with the central
  123. 6:48uh sonar Cube server and based on the
  124. 6:51rules it validates the whatever the code
  125. 6:53is written and uh it uh applies all the
  126. 6:58rules to to the across the projects and
  127. 7:02across the all the team members also we
  128. 7:05review uh each other's code yeah so
  129. 7:08these are the various uh okay what are
  130. 7:11the design patterns you follow in
  131. 7:14microservices yeah there are various
  132. 7:17design patterns API Gateway pattern is
  133. 7:19there uh circuit break breaker pattern
  134. 7:22is there so whenever uh we have uh uh
  135. 7:27any services not reach table or
  136. 7:30something like that so we write the
  137. 7:31fallback method for that then we have a
  138. 7:35service Discovery pattern is there so
  139. 7:38this helps microsof dynamically discover
  140. 7:40each other so they using the
  141. 7:45registry and then we have Saga design
  142. 7:48pattern so this manages distributed
  143. 7:51transactions across the micro services
  144. 7:53using the uh series of local
  145. 7:56transactions with uh uh compan set
  146. 7:59actions so yeah these are the design
  147. 8:02patterns are there okay how do you
  148. 8:04resolve version conflict in m in a
  149. 8:07spring boot yeah we resolve version
  150. 8:11conflict
  151. 8:12using uh we have a command I think MH uh
  152. 8:16M dependency then tree so that we used
  153. 8:21to visualize the entire dependency tree
  154. 8:24and
  155. 8:25identify uh where the conflict is so
  156. 8:29basically this command shows us uh which
  157. 8:31dependencies are pulling in Conflict
  158. 8:33version that is one way also if the
  159. 8:37dependency is brought in
  160. 8:39transitively so maybe uh by any other
  161. 8:44dependency then we can explicitly Define
  162. 8:47the version of that dependency to
  163. 8:51resolve uh if we have to downgrade or
  164. 8:54upgrade that so we can do that so it
  165. 8:58will override the uh by default uh
  166. 9:01version apart from that we can also use
  167. 9:03exclusions if we don't want any uh like
  168. 9:08interdependency uh like if any
  169. 9:11dependency is downloading other
  170. 9:13dependency and we don't want that then
  171. 9:15we can use exclusions for that as well
  172. 9:19so yeah so these are the ways okay what
  173. 9:22is the difference between war and
  174. 9:25embedded
  175. 9:26containers yeah War basically contains
  176. 9:30the one application it does not have the
  177. 9:36external server like Tom cat or Jos
  178. 9:40whatever we use but embedded container
  179. 9:44will have the embedded server so default
  180. 9:48will be Tomcat so we don't have to
  181. 9:51explicitly download server and deploy
  182. 9:54the application over there so this is
  183. 9:57the main difference between uh dig to
  184. 9:59what is a spring boot
  185. 10:01profiles yeah spring boot profiles are a
  186. 10:05way to segregate parts of our
  187. 10:09application uh and make it available
  188. 10:11only in certain environments like we can
  189. 10:15have multiple environments like uh we
  190. 10:18can have Dev environment we can have QA
  191. 10:20we can have production right so uh
  192. 10:24sometimes we want certain settings to or
  193. 10:28certain configurations to work only with
  194. 10:31the uh specific environment so profiles
  195. 10:35comes into picture and we use profiles
  196. 10:38for this purpose so we can have uh
  197. 10:41separate Properties or EML files for
  198. 10:45different uh profiles like maybe
  199. 10:49application uh dev. properties
  200. 10:52application test. properties like that
  201. 10:55and uh whatever the profiles will will
  202. 10:59be set if it is profile is dev then
  203. 11:02application dev. properties will be
  204. 11:04picked up there are some common
  205. 11:07properties are also there so that can be
  206. 11:10picked from the application properties
  207. 11:12only but those which are a specific to
  208. 11:16the dev or test environment so apart
  209. 11:18from those application properties those
  210. 11:21application Dev properties also will be
  211. 11:23picked if the profile is Dev to access
  212. 11:27the active profiles I think think uh we
  213. 11:31have one environment object so that we
  214. 11:34can uh inject to the class wherever we
  215. 11:38want that so with that environment. get
  216. 11:43active profiles will give us the uh
  217. 11:46active
  218. 11:47profile so yeah okay what are the
  219. 11:51advantages and this advantages of spring
  220. 11:55boot yeah there are various advantages
  221. 11:58of a spring boot
  222. 12:00so uh it it it has removed lots of
  223. 12:04configuration Parts which we used to do
  224. 12:07in Spring
  225. 12:10so um so spring boot provides many Auto
  226. 12:14configurations so that allows basically
  227. 12:17the developers to focus only on to
  228. 12:20writing the
  229. 12:22Logics uh so and not focusing on the
  230. 12:25configuration part and also it provides
  231. 12:29the embedded server so we don't have to
  232. 12:33explicitly uh add go and add the servers
  233. 12:36right so we have Tom cut by default and
  234. 12:40then in Spring we had lots of XML
  235. 12:43configurations and all that is not
  236. 12:45required uh anymore in Spring boot right
  237. 12:48so so all the bu plate codes has been
  238. 12:52REM spring also we can achieve without
  239. 12:55writing the XML right we don't have to
  240. 12:58write the XML yeah yeah uh you are right
  241. 13:02so basically from the spring 3.0 onwards
  242. 13:06the that framework introduced the uh
  243. 13:10capability to use a Java based
  244. 13:12configurations with uh add
  245. 13:14configurations and add dat to Bean
  246. 13:16annotations so user no need to uh use
  247. 13:22XML based configuration
  248. 13:24anymore but in Spring boot uh from the
  249. 13:28very beginning itself if there is
  250. 13:29nothing uh we have to do with the xmls
  251. 13:33so the configuration part is uh has been
  252. 13:37automated so spring boot starter
  253. 13:41dependencies uh that package the
  254. 13:43commonly used libraries together so we
  255. 13:46don't have to worry about the versions
  256. 13:49and
  257. 13:50compatibility of the different libraries
  258. 13:52with each other because this comes in a
  259. 13:55bundle
  260. 13:56so yeah so these are the uh advantages
  261. 14:00are
  262. 14:01there okay and
  263. 14:05disadvantages yeah disadvantages are
  264. 14:08like um whenever we have a very a small
  265. 14:12application so we should not go for the
  266. 14:17uh spring Boot and all we can go with
  267. 14:20the uh simple monolithic
  268. 14:23application so I mean for simple
  269. 14:27applications or microservices
  270. 14:29so spring boot is kind of maybe
  271. 14:34unnecessary so we can go for other
  272. 14:38lightweight Frameworks in that
  273. 14:40case and uh
  274. 14:43also sometimes uh the auto configuration
  275. 14:46behavior in a spring
  276. 14:48boot uh we Face uh we may face the
  277. 14:53conflicts so we have to uh debug it and
  278. 14:57see like which version of which jar has
  279. 15:00been downloaded and all so we have to
  280. 15:03resolve it right and also we have uh
  281. 15:07various microservices right so suppose
  282. 15:11uh um whatever
  283. 15:15the uh
  284. 15:18data we have in one of the micros
  285. 15:22service so we have to make sure that all
  286. 15:25the microservices are in sync with each
  287. 15:27other so sometimes any of the
  288. 15:30microservice is not working or it is
  289. 15:33down or its database is not getting
  290. 15:35updated we have to make sure when it is
  291. 15:38up it should be in sync so these are the
  292. 15:41challenges are also there so yeah these
  293. 15:43are the uh disadvantages are there okay
  294. 15:47okay what is the difference between rest
  295. 15:50controller and
  296. 15:52controller yeah rest controller is
  297. 15:54nothing but controller with response
  298. 15:57body so that is what we say rest
  299. 16:00controller we use uh
  300. 16:03controller uh when we have the uh MBC
  301. 16:07architecture we are working with and the
  302. 16:10response we want to uh return to uh JSP
  303. 16:16page or similar so in that case we work
  304. 16:20we go for
  305. 16:22controller but uh if we have restful web
  306. 16:26service so in that case we use rest
  307. 16:29controller so we don't have to
  308. 16:31explicitly write uh at rate of response
  309. 16:35body in this case so whenever we have to
  310. 16:38return model and view object so in that
  311. 16:40case we use uh add controller but
  312. 16:43whenever it is uh uh restful uh web
  313. 16:47service in that case we go go for the
  314. 16:50add dat of rest controller okay what is
  315. 16:52the difference between get mapping and
  316. 16:55request mapping yeah request mapping is
  317. 16:59like kind of more generic way of uh
  318. 17:03getting the mapping so we can have get
  319. 17:07post put delete all that with along with
  320. 17:10the request
  321. 17:11mapping so we can use as per our but get
  322. 17:16mapping is like more specialized to
  323. 17:19getting the data so request mapping and
  324. 17:22Method equal to get is similar to get
  325. 17:24mapping so get mapping is more
  326. 17:27convenient to use whenever we have the
  327. 17:30get request also request mapping we can
  328. 17:33use for broader use cases like uh uh we
  329. 17:37can specify the request parameters
  330. 17:40headers media types and all that also
  331. 17:44this consumes and produces also we can
  332. 17:46give so request mapping can be used for
  333. 17:49all but uh we have been provided with
  334. 17:53get mapping post mapping put mapping
  335. 17:56delete mapping so we have any speci
  336. 17:58specific kind of mapping we want to do
  337. 18:01so we can go with these okay what are
  338. 18:04the common security
  339. 18:06vulnerabilities found in web
  340. 18:10applications uh there are many of them
  341. 18:13so one is the injection attack then we
  342. 18:17have cross site scripting uh not using
  343. 18:20of https using HTTP instead and trying
  344. 18:23to use uh directly uh accessing the
  345. 18:27sensitive resources maybe some files or
  346. 18:30database without any proper
  347. 18:32authentication or
  348. 18:34authorization so to have these uh we
  349. 18:38should do proper authentication and
  350. 18:40authorization so whatever the inputs are
  351. 18:42coming from the users we should have the
  352. 18:46proper validation of those inputs so
  353. 18:49that they can not run the any kind of
  354. 18:53scripting and all to our application and
  355. 18:57also uh we should not allow from the
  356. 19:00cross site so we have the uh uh
  357. 19:07configuration uh using which we can
  358. 19:10disable this uh cross site uh access of
  359. 19:15the application also we should try
  360. 19:17avoiding and secure apis apis that do
  361. 19:21not Implement proper authentication
  362. 19:24validation or encryption so that can
  363. 19:27also exploit
  364. 19:29that can also be exploited by attackers
  365. 19:31to access or uh manipulate any sensitive
  366. 19:34data so yeah so these are the
  367. 19:37vulnerabilities we have how do you
  368. 19:40handle complex queries using spring data
  369. 19:44jpa so spring data jpa basically gives
  370. 19:48uh the it has whole lots of
  371. 19:50documentation in which we have uh let's
  372. 19:53say very complex query so such as uh
  373. 19:57let's say some employee which has salary
  374. 20:00or some greater than some amount so we
  375. 20:04have inbuilt method so find uh employees
  376. 20:08with salary greater than we can use for
  377. 20:11that so uh we don't have to write the
  378. 20:14whole query uh Native query in this case
  379. 20:17but wherever the uh jpql so this is
  380. 20:21basically called the jpql so which is
  381. 20:25provided by uh spring data jpa so uh
  382. 20:29wherever this JP jpql is not allowed or
  383. 20:34uh sorry jpql is uh we cannot write
  384. 20:38suppose we cannot write that then in
  385. 20:40that case we can also go with the native
  386. 20:44queries so so that we can write using uh
  387. 20:48at the rate of query and there we can
  388. 20:50give value and there we can write the
  389. 20:53whole query right so that way we can
  390. 20:56write the uh native queries we can also
  391. 21:00write the procedures if required and
  392. 21:04that procedure we can directly call from
  393. 21:06our repository class apart from that we
  394. 21:10can also use a
  395. 21:11specifications so for dynamic and
  396. 21:14complex queries we can use a
  397. 21:16specification API uh provided by Spring
  398. 21:20data jpa so that allows us to build
  399. 21:23queries programmatically using criteria
  400. 21:26API so we can use criteria builder for
  401. 21:29that and then we can use that okay so
  402. 21:32suppose you have a huge data in your
  403. 21:35database and you have to se all this
  404. 21:39data to
  405. 21:40UI so what approach you
  406. 21:43follow can you explain yeah so whenever
  407. 21:47we have a huge data in that case uh if
  408. 21:52uh we have to S it to some UI so we
  409. 21:55don't s all of them all together
  410. 21:59so we can use pagin basically MH so um
  411. 22:03at a time let's say if the UI has the
  412. 22:06capability to S like 10 items so we will
  413. 22:11uh share only 10 items to the uh UI
  414. 22:15whatever the request is passed from the
  415. 22:18UI so that will have the information of
  416. 22:22the offset and limit like limit means
  417. 22:27like how many items it wants and offset
  418. 22:29me from which like suppose already we
  419. 22:31are on the third page so maybe 31st to
  420. 22:3640th item we would like to process and
  421. 22:39show to UI MH so uh limit will be 10 and
  422. 22:43offset will be uh like
  423. 22:4631st okay so we can show uh like 10 or
  424. 22:51nine items uh whatever it
  425. 22:54is so for that uh we have a payable
  426. 22:58object
  427. 22:59so we prepare the pageable object from
  428. 23:02the uh whatever the request has come and
  429. 23:06that response will basically can be used
  430. 23:08by UI to show the data okay okay okay so
  431. 23:14what is multi- threading
  432. 23:16multithreading is a
  433. 23:19concept that allows multiple threads to
  434. 23:22run concurrently uh within a single
  435. 23:24process so whenever we have multicore
  436. 23:28process processors so we can leverage
  437. 23:31the processor uh capability so basically
  438. 23:34it utilizes a CPU uh
  439. 23:38resources efficiently by performing uh
  440. 23:41multiple operations
  441. 23:43simultaneously so each thread can
  442. 23:45execute a part of the program
  443. 23:48independently so that enables the
  444. 23:51parallel execution and improves the
  445. 23:54performance of application especially on
  446. 23:57the multicore for
  447. 23:59processors okay so what are the
  448. 24:01different states of threat in Java yeah
  449. 24:05we have a new runable blocked
  450. 24:09waiting and
  451. 24:13terminated yeah so these are the states
  452. 24:15we have okay okay so what are the
  453. 24:19various ways you can create multi
  454. 24:22threading in
  455. 24:23Java yeah there are various ways one is
  456. 24:27uh we can use extends
  457. 24:29keyword and um uh we can say with any
  458. 24:33class we can extend thread so we can
  459. 24:36create new thread by extending the
  460. 24:37thread class and we can override its run
  461. 24:41method so that is one way then we can
  462. 24:46also uh create a thread by implementing
  463. 24:49the renable interface and we can pass an
  464. 24:53instance of the class to a uh thread
  465. 24:57object
  466. 24:58so this is another way then we have the
  467. 25:02uh executor framework so the executor
  468. 25:06framework provides
  469. 25:08a uh high level replacement for managing
  470. 25:11threats so that allows us to create a
  471. 25:15thread pool and manage task execution uh
  472. 25:18more
  473. 25:19efficiently so we have executor service
  474. 25:22for that so yeah so these are the ways
  475. 25:25uh we can create the thread okay what is
  476. 25:27Java memory model yeah the Java memory
  477. 25:30model defines how threads interact
  478. 25:34through memory and uh how changes made
  479. 25:38by one thread become visible to another
  480. 25:41so it specifies rules for reading and
  481. 25:44writing variables handling threads
  482. 25:47synchronization and providing uh
  483. 25:50guarantees on visibility ordering and
  484. 25:53atomicity okay what are the different
  485. 25:56types of exception in Java
  486. 25:59yeah we can categorize the exceptions in
  487. 26:02mostly uh three parts actually one is
  488. 26:05checked then unchecked and then
  489. 26:08errors so uh checked exceptions are
  490. 26:12those which must be caught or declared
  491. 26:15in the method
  492. 26:17signature like uh we have IU exception
  493. 26:20SQL exception or file not found
  494. 26:23exception right so whenever we write the
  495. 26:26code so there itself uh the compiler
  496. 26:30suggest
  497. 26:32to uh I mean that enforce that will
  498. 26:35enforce us to handle it if we are not
  499. 26:38writing it so we write in the exception
  500. 26:42block like IU exception X exception and
  501. 26:44then we further we can continue our code
  502. 26:47then coming to unchecked exception so
  503. 26:50unchecked exception include uh runtime
  504. 26:54exception that do not need to be
  505. 26:56explicitly handled so so some exceptions
  506. 27:00like null pointer array out out of bond
  507. 27:03exception then current concurrent
  508. 27:06modification exception so all these
  509. 27:08comes under uh unchecked exception so
  510. 27:12this is basically going to happen at
  511. 27:13runtime so we cannot predict that in
  512. 27:17advance and then uh uh we have errors so
  513. 27:22the errors are the kind of we can say uh
  514. 27:27which we cannot handle at all so this is
  515. 27:31a this is an irrecoverable situation so
  516. 27:35which cannot be handled so and this we
  517. 27:38can say very serious problems and
  518. 27:40application uh cannot catch it so like
  519. 27:43out of memory error is there stack
  520. 27:45Overflow is there is there yeah so these
  521. 27:48are the various types of uh exceptions
  522. 27:51are there okay can you explain the
  523. 27:54difference between string string Builder
  524. 27:57and string buffer yeah string is uh
  525. 28:02immutable and string Builder and string
  526. 28:05buffer is
  527. 28:06mutable
  528. 28:07so uh basically um string once created
  529. 28:13its value cannot be changed in case of a
  530. 28:16string but in a string
  531. 28:18Builder uh its values can be changed so
  532. 28:21that is why it is
  533. 28:23mutable and uh string Builder is
  534. 28:26designed for single threaded
  535. 28:28uh uh use and is faster than a string
  536. 28:32buffer and string buffer is thread safe
  537. 28:36it is
  538. 28:37synchronized and it makes it suitable
  539. 28:40for multi- trading environments so it is
  540. 28:43uh slower than a string
  541. 28:45Builder so yeah okay what is the purpose
  542. 28:48of transient keyword in Java yeah the
  543. 28:51transient keyword is used to include the
  544. 28:55that a field should not be serialized
  545. 28:58when an object is serialized transient
  546. 29:01fields are ignored so whatever the
  547. 29:04suppose we have a bean class and in that
  548. 29:07bean class we have multiple
  549. 29:10properties right so out of those
  550. 29:14properties in if any of the properties
  551. 29:16have transient keyword so that won't be
  552. 29:20cized so that field will be ignored and
  553. 29:24their values are not included in the
  554. 29:27cized presentation okay what is the
  555. 29:30difference between hashmap and
  556. 29:32concurrent hashmap so hashmap is not
  557. 29:36thread safe and it can lead to uh
  558. 29:40inconsistent data in a multi-threaded
  559. 29:43environment uh while concurrent has map
  560. 29:46is designed for uh concurrent access and
  561. 29:49allows multiple threats to read and
  562. 29:51write
  563. 29:52simultaneously without locking the
  564. 29:54entire map so the uh locking is uh done
  565. 29:58only on on the particular bucket not on
  566. 30:02the entire U map then concurrent has
  567. 30:06map uh performs better uh in a
  568. 30:10concurrent environment uh because it's
  569. 30:13uh uh because uh it uses segment locking
  570. 30:17so that allows concurrent rights so
  571. 30:21concurrently writing is possible in this
  572. 30:24case and then uh uh in hashmap allows
  573. 30:28one null key and multiple null values
  574. 30:31while concurrent hashmap does not allow
  575. 30:33null keys or values okay what are memory
  576. 30:37leaks and how you can prevent them yeah
  577. 30:42memory leak in Java occurs when objects
  578. 30:44are no longer used but are still being
  579. 30:47referenced so this prevents the garbage
  580. 30:53collector from reclaiming the memory so
  581. 30:57the common causes includes static uh
  582. 31:00references or any long lived objects or
  583. 31:04improperly managed collections or we
  584. 31:07have not closed the connections so those
  585. 31:09things so we can prevent uh using uh
  586. 31:14weak uh
  587. 31:15references so uh we can use weak hmap
  588. 31:18for objects that can be uh garbage
  589. 31:21collected uh when not in use and uh we
  590. 31:26can avoid a static references uh unless
  591. 31:29it is
  592. 31:30necessary and also we can monitor memory
  593. 31:33uh uses uh with uh profiling tools like
  594. 31:38visual VM or J
  595. 31:40profiler so yeah okay what is the
  596. 31:44optional class in Java
  597. 31:478 yeah the optional class in Java 8 has
  598. 31:51been introduced to handle uh null
  599. 31:53pointer exception so earlier uh before
  600. 31:56Java 8 we used to write the manually we
  601. 32:00used to write the uh logic to handle
  602. 32:04null so maybe in case of string we used
  603. 32:07to use sing utils
  604. 32:10Dot and all and uh if or in case of
  605. 32:13other objects equal to equal to null so
  606. 32:16all that we used to write but now from
  607. 32:18java 8 onwards we don't have to write
  608. 32:20that so it helps us to prevent null
  609. 32:24pointer exception and represents a value
  610. 32:27that
  611. 32:28could be absent so we can use it when a
  612. 32:32method might not return a value so let's
  613. 32:36say we have find by ID and it is not
  614. 32:38returning a value may not return the
  615. 32:40value so we can use optional in that
  616. 32:42case as a uh return type of that and
  617. 32:46then to express the intention of uh
  618. 32:51possibly absent values also we can use
  619. 32:53it and to chain method calls safely
  620. 32:58without null checks we can use this so
  621. 33:02yeah okay what is Method referencing in
  622. 33:05Java 8 yeah method reference in Java 8
  623. 33:09are we can say it is s hand of Lambda
  624. 33:13expression to call a method so they
  625. 33:17provide a way to reference a method
  626. 33:19without invoking it making the code
  627. 33:21cleaner and more readable so we can use
  628. 33:25a double colon for that so any class has
  629. 33:30any suppose a static method so uh uh we
  630. 33:35can use double colon uh in front of that
  631. 33:38class and we can give the method name
  632. 33:41and like this way we can fetch that so
  633. 33:44yeah okay what is the difference between
  634. 33:46join and a subquery in which scenario
  635. 33:50you will prefer to use join and in which
  636. 33:53scenario you will prefer to use subquery
  637. 33:56so they used to combine data from
  638. 33:57multiple tables so join is used to
  639. 34:00combine uh Row from two or more tables
  640. 34:03so we can have inner join uh then we
  641. 34:06have left join right join then full join
  642. 34:09so these are the types of join we have
  643. 34:13so we will have the uh uh the relatable
  644. 34:18column between the tables and based on
  645. 34:21those columns we can perform the join
  646. 34:24operation then uh coming to subquery so
  647. 34:27subquery is a query nested within
  648. 34:32another query so we for example we have
  649. 34:37uh some star from something and then in
  650. 34:41we can write and then we can have
  651. 34:42another query so that query we say as a
  652. 34:46subquery so it can return a single value
  653. 34:49a list of values or a complete table
  654. 34:52itself so subquery can be used in select
  655. 34:56or from or where or having Clauses so
  656. 34:59normally we try not to use subqueries if
  657. 35:03it possible because uh they are normally
  658. 35:08less efficient than the joints so mostly
  659. 35:11we try to use joints only wherever
  660. 35:13possible okay what is the difference
  661. 35:15between having and wear clause in esql
  662. 35:19yeah the having and wear Clause both
  663. 35:22used to filter records in SQL but they
  664. 35:26are little bit different
  665. 35:28uh based on the scenarios like uh where
  666. 35:32Clause is used to filter records before
  667. 35:34any groupings are
  668. 35:36made uh but having Clause is used to
  669. 35:40filter records after the agregation so
  670. 35:44it basically works on the aggregated
  671. 35:47data like uh it is used with uh uh Group
  672. 35:52by uh to filter groups based on the
  673. 35:55aggregated function like some count or
  674. 35:58average so we Clause uh basically used
  675. 36:01to filter records based on the specific
  676. 36:04conditions on columns so we can write
  677. 36:07like select a start from employee where
  678. 36:09salary uh greater than uh some amount
  679. 36:13and whenever we have to uh use the
  680. 36:16having Clause so that we use we can use
  681. 36:20with the group by like let's say select
  682. 36:24some ID and then count of a star
  683. 36:27and that from uh employee Group by
  684. 36:32employee ID having count of a star
  685. 36:34greater than 10 so in this case we can
  686. 36:37use the having
  687. 36:39Clause so yeah okay okay

About this transcript

This page contains the full transcript of 3-7 Years Interview Experience | Java | Spring Boot | Microservices | SQL | Nagarro by Insights Instructor, generated from the public captions YouTube serves with the video. The transcript has 4,646 words across 687 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.