This example would be better in explaining deep copy(constructor method): public Example(Example original) { this.x= original.x; } Example example2 = new Example(example1); example2.x = 200; sout(example1.x);
The protected explanation is incorrect. Enemy and Ghost didn't have to be in the same package. Ghost could have accessed the protected name filed as long as it extends Enemy class. Your example would be correct with default modifier which is package-private.
Deep copy copies all the values of the source object, so even if the value of the source object changes, the value of the copied object will not change. You can implement deep copy in these three ways: 1. Using Cloneable interface and clone method. However, the deep copy in this way is limited. If the object contains other reference types, the copies of these reference types are still shallow copies. 2. Using serialization and deserialization. Deep copying is achieved by converting an object to a byte stream and then back to an object from the byte stream. This method can handle all reference relationships of the object and ensure that the copied object is independent. 3. Assign values one by one in the constructor of the copied object Besides, you can use third-party libraries as well
8:00 this doesn't really explain what shallow and deep copies are. It's not a deep copy if you just create a new object and populate it manually. The default implementation of clone() on Object creates a new instance of that class with new references to the same referenced object fields of the original - this is a shallow copy. You can override clone() to create a deep copy by creating new referenced object fields. This way if anything changes in the referenced object fields it is only reflected in the new deep copy, not the original.
great job on this one - just noticed a slight nuance to observe. I think the default access modifier Eg no modifier will allow other classes inside the package to access the variables/methods but protected will only allow child classes which extends their parent class to access those variables/methods which are protected.
Protected members also can be accessed from the same package, please read docs. It gives you access for protected members in the same package and for children, in the same or different packages.
@@davidblbulyan3077 No they Actually can't, Only Subclasses of the class that has the protected attribute have access to that attribute, even if all the classes are in the same package. If you have a protected attribute inside a class A and you have a class B that extends A, and class C (which doesn't extend A) is in the same package as A and B, then class C will not be able to access the protected attribute of class A`. While using default makes class fields 'package-private' = Accessible to all classes within the same package but not outside of it.
Thank you so much for sharing the valuable knowledge. I'm junior and I learned many thing from your video. Good job. It'd be great for junior developer
Seems like a great interview. I usually make similar questions to juniors. The problem comes with companies that basically make juniors grind leetcode like monkyes :_(
Nowadays the default garbage collector is multithread, so it basically doesn't stop the app, it will stop really quickly each thread, but never all at once. Junior's doesn't have to know that, but it's always good to make it clear to all seniority, even tho threads are something kinda complex for entry-level devs xD (and basically we don't have good online material about that, no course is that advanced, and u mostly find things about it in books, mainly using C as example, I've even seen one in Assembly LoL)
@ I didn't. It was java, spring and ds related questions. With a lot of codes for you answer if it will compile or not, what kind of exceptions it will throw, what output it will print and etc.
There are mistakes and understatements in this video, and two of which are: you're mixing arraylist with array. Q21. is actually array. As for Q22. You're actually explaining array, not ArrayList and even if it was just a name mixup - how is array growing dynamically? It's not. ArrayList does.
can someone do me a favor what project application or any logical practice should I make I have basics knowledge on java and I just want to improved it by writing a code or a project :(
I got interviewed by a senior developer who asked me a question that he thought he knew the answer to but ended up being wrong. After answering his questions he arrogantly tried to enforce his answer onto mine telling me I needed to check my information and that I'm wrong. After the interview I checked if his info was correct since I'm still learning after all and I might've messed it up. Turns out I was 100% correct. Tbh even these questions are only 1/5 of all the questions you must know for a junior level position nowadays.
@@kacperk2201 "Is the finally block always executed ? Will it execute if an exception occurs?" Said yes but the answer somehow wasn't correct based on his information 🤣🤣
@@AngelGiurov I mean it is designed to execute always, but in fact it can be omitted in rare circumstances, maybe that’s what he wanted to check with you, cheeky question. It might not execute for example if you terminate the system with system.exit or you run out of memory, or infinite loop in try block, so technically he was kinda correct. If an exception occurs “outofmemoryerror” it’s not gonna execute but kinda weird to ask such cheeky question for a junior dev.
@@kacperk2201 I'm aware of when it won't execute so that's why I got mad at the answer. The java code executes line by line. So the only reason for why it won't reach the finally block is if the program itself stops or if we are in a infinite loop. If I was wrong it was 100% some corner case BS BUUUUUUT in this case I was correct. He asked specifically if it will execute if a exception occurs and it 100% does. But from his knowledge I was incorrect and instead of telling me why he said in a very angry but yet again passive aggressive voice "Check your information because you're incorrect". That's a FCKING SENIOR DEVELOPER. Now my first case also. My last interview for a junior position I was interviewed by two indians. The first interview which was a mistake and apparently they didn't see anything wrong with it was when I was supposed to do a full on code review for another junior developer. Had to learn how their code functioned, how it worked and leave 20-40 comments 😂😂😂😂. After the obvious fail because I am not a senior dev (the process instructions were for a senior dev) and after 2 hours total wasted they told me "yeah I don't think we were supposed to ask you that" so we scheduled another interview. Everything were more than great but got rejected because I forgot that you need to use "group by" when using aggregation and I didn't have experience with agile terminology. Also one of those indian interviewers wanted to dive deeper into mysql and asked me what kind of data structure it is. I simply forgot since it was a very long time ago since I was curious about it. I decided to ask him for the answer because I wanted to remember... He said "It's fine, I don't know it either". The market is absurd for juniors
Your example of the pass by value versus pass by reference is not correct. Java is BOTH: pass by value for the primitive parameters AND pass by reference for the class/object types. Java Never copies objects when they are passed into a method call. You are confusing C++ (pass by reference) with Java's. Java only copies the reference value of the object when passed in the method call and as a result of that: both references, from the caller method and the one from the called method point to the same object in the Heap thus the changes will be seen from both locations (ex: in the method called and, in the method, making the call).
How can you describing abstract class without saying even word about interfaces? Its the most asked question i think. Also this abstract description is covering max 20% of abstract topic. Nothing about inherritance of abstract classes, abstract methods etc, its really common tricky question
what are good interview questions/concepts for Junior Java Dev Roles? I have almost 2 yrs of experience as java tester but its boring and the pay sucks
📚courses.keeponcoding.io - Check out my courses!
Not opening up for me
Good job on this one! It would be great to see an advanced/intermediate JAVA interview questions.
This example would be better in explaining deep copy(constructor method):
public Example(Example original) {
this.x= original.x;
}
Example example2 = new Example(example1);
example2.x = 200;
sout(example1.x);
the "has a" example being a person has a job is such a roast on a video meant for interviews
The protected explanation is incorrect. Enemy and Ghost didn't have to be in the same package. Ghost could have accessed the protected name filed as long as it extends Enemy class. Your example would be correct with default modifier which is package-private.
You didn’t explain what is deep copy, you just crated a new object.
But what if I want to create exactly the same copy of existing instance?
Deep copy copies all the values of the source object, so even if the value of the source object changes, the value of the copied object will not change.
You can implement deep copy in these three ways:
1. Using Cloneable interface and clone method. However, the deep copy in this way is limited. If the object contains other reference types, the copies of these reference types are still shallow copies.
2. Using serialization and deserialization. Deep copying is achieved by converting an object to a byte stream and then back to an object from the byte stream. This method can handle all reference relationships of the object and ensure that the copied object is independent.
3. Assign values one by one in the constructor of the copied object
Besides, you can use third-party libraries as well
8:00 this doesn't really explain what shallow and deep copies are. It's not a deep copy if you just create a new object and populate it manually. The default implementation of clone() on Object creates a new instance of that class with new references to the same referenced object fields of the original - this is a shallow copy. You can override clone() to create a deep copy by creating new referenced object fields. This way if anything changes in the referenced object fields it is only reflected in the new deep copy, not the original.
We need a whole series on these
I was a c# dev for 5 years but I’m interviewing for a Java position today. Thanks for the refresher!
Why would you change stream?
great job on this one - just noticed a slight nuance to observe. I think the default access modifier Eg no modifier will allow other classes inside the package to access the variables/methods but protected will only allow child classes which extends their parent class to access those variables/methods which are protected.
Protected members also can be accessed from the same package, please read docs. It gives you access for protected members in the same package and for children, in the same or different packages.
@@davidblbulyan3077 No they Actually can't, Only Subclasses of the class that has the protected attribute have access to that attribute, even if all the classes are in the same package.
If you have a protected attribute inside a class A and you have a class B that extends A, and class C (which doesn't extend A) is in the same package as A and B, then class C will not be able to access the protected attribute of class A`.
While using default makes class fields 'package-private' = Accessible to all classes within the same package but not outside of it.
25:47
Thank you so much for sharing the valuable knowledge. I'm junior and I learned many thing from your video. Good job. It'd be great for junior developer
more videos like this please, I love it, thankyou!
I have an upcoming interview and your explainations is so good.
How did it go?
We still waiting on update how did it go
Seems like a great interview. I usually make similar questions to juniors. The problem comes with companies that basically make juniors grind leetcode like monkyes :_(
Are you offering any JAVA internships right now ?
Please make a video of some more advanced questions...Very Good work
Thanks a lot Sam, I am having my technical interview for Internship this week, and your video is so helpful, fingers crossed
I loved this video, thank you, super useful!
Wow! Thank you for showing the examples!
This was a really good video
You explained each concept in a very easy way thanks ☕more videos please🤩
lol ... i am definitely failing my next interview
How’d it go
😂
how did it go😊
What did you in college? Party non stop 😂? These aren’t difficult at all
Same
Paused at 1:01 and glad to know I would pass the Jr. Java coding interview 😂
Nowadays the default garbage collector is multithread, so it basically doesn't stop the app, it will stop really quickly each thread, but never all at once. Junior's doesn't have to know that, but it's always good to make it clear to all seniority, even tho threads are something kinda complex for entry-level devs xD (and basically we don't have good online material about that, no course is that advanced, and u mostly find things about it in books, mainly using C as example, I've even seen one in Assembly LoL)
Great video brother.
This is so easy, once I have applied to EPAM for Junior Position, their test was like 1500 times harder
Did you pass the interview? What kind of questions did they ask?
@ I didn't. It was java, spring and ds related questions. With a lot of codes for you answer if it will compile or not, what kind of exceptions it will throw, what output it will print and etc.
Yeessss..... I needed to see this I'm graduating next may with my degree in Computer programming and Development 😊 this is helpful 😊
I would have liked more explanation on where we are using. But thanks for this.
Good for Test Engineers too. Please mention in the description
Good job, really helpful
Great video
love it, more videos please
Very noice. I don’t see the link to the other vid discussing “Comparator” etc.
I added it to the description. Thank you.
@@KeepOnCoding thank you. We appreciate your efforts and hard work creating these vids. 🙌🏿🙏🏾☺️
Thank you!
God Bless You!
thank you thank you
Has Java not changed since 2015
Are u sure that stack space is fixed?
There are mistakes and understatements in this video, and two of which are: you're mixing arraylist with array. Q21. is actually array. As for Q22. You're actually explaining array, not ArrayList and even if it was just a name mixup - how is array growing dynamically? It's not. ArrayList does.
what is the name of the app he is using for list of questions?
MySpace
can someone do me a favor what project application or any logical practice should I make I have basics knowledge on java and I just want to improved it by writing a code or a project :(
Hey, I’m looking to create a project also. Would you be interested in building something together?
very good
Can you provide Timestamp ?
What's the experience range for a junior java developer. 0 - ?.
Could be anything, i know Seniors with 3-4y experience, while there are juniors with 3y experience too. Keep learning 💪🏾
Lifesaver
Junior role In indian edtech company with employees
Good
To be fair I know senior developers that couldn't answer some of these.
I got interviewed by a senior developer who asked me a question that he thought he knew the answer to but ended up being wrong.
After answering his questions he arrogantly tried to enforce his answer onto mine telling me I needed to check my information and that I'm wrong. After the interview I checked if his info was correct since I'm still learning after all and I might've messed it up. Turns out I was 100% correct.
Tbh even these questions are only 1/5 of all the questions you must know for a junior level position nowadays.
@@AngelGiurov what question was it exactly ?
@@kacperk2201 "Is the finally block always executed ? Will it execute if an exception occurs?" Said yes but the answer somehow wasn't correct based on his information 🤣🤣
@@AngelGiurov I mean it is designed to execute always, but in fact it can be omitted in rare circumstances, maybe that’s what he wanted to check with you, cheeky question. It might not execute for example if you terminate the system with system.exit or you run out of memory, or infinite loop in try block, so technically he was kinda correct. If an exception occurs “outofmemoryerror” it’s not gonna execute but kinda weird to ask such cheeky question for a junior dev.
@@kacperk2201 I'm aware of when it won't execute so that's why I got mad at the answer. The java code executes line by line. So the only reason for why it won't reach the finally block is if the program itself stops or if we are in a infinite loop.
If I was wrong it was 100% some corner case BS BUUUUUUT in this case I was correct. He asked specifically if it will execute if a exception occurs and it 100% does. But from his knowledge I was incorrect and instead of telling me why he said in a very angry but yet again passive aggressive voice "Check your information because you're incorrect". That's a FCKING SENIOR DEVELOPER.
Now my first case also. My last interview for a junior position I was interviewed by two indians.
The first interview which was a mistake and apparently they didn't see anything wrong with it was when I was supposed to do a full on code review for another junior developer. Had to learn how their code functioned, how it worked and leave 20-40 comments 😂😂😂😂.
After the obvious fail because I am not a senior dev (the process instructions were for a senior dev) and after 2 hours total wasted they told me "yeah I don't think we were supposed to ask you that" so we scheduled another interview.
Everything were more than great but got rejected because I forgot that you need to use "group by" when using aggregation and I didn't have experience with agile terminology.
Also one of those indian interviewers wanted to dive deeper into mysql and asked me what kind of data structure it is. I simply forgot since it was a very long time ago since I was curious about it. I decided to ask him for the answer because I wanted to remember... He said "It's fine, I don't know it either". The market is absurd for juniors
Your example of the pass by value versus pass by reference is not correct. Java is BOTH: pass by value for the primitive parameters AND pass by reference for the class/object types. Java Never copies objects when they are passed into a method call. You are confusing C++ (pass by reference) with Java's. Java only copies the reference value of the object when passed in the method call and as a result of that: both references, from the caller method and the one from the called method point to the same object in the Heap thus the changes will be seen from both locations (ex: in the method called and, in the method, making the call).
Person hasa job... mine is set to false.
La verdad que mas de una explicacion deja mucho que desear
In Russia, it is, mildly speaking, insufficient to know even at trainee.
What do you mean? Expectation is so high?
@@ozan546 You must know much more than it was represented in the video.
At trainee position, you must know perfectly
- Java Core
- JDBC
- Spring (различное всякое говно)
- Thymeleaf
- XML
- Паттерны проектирования
- MVC
- Hibernat
- HTML
- CSS
- JS
- БД
- HTTP
- JSON
@@БубликПомидорович I understand. Good luck
@@БубликПомидорович Agreed, but you forgot Docker, RabbitMQ/Kafka, AWS, Kubernetes, Maven/Gradle, JUnit5/Mockito, GIT
Actually, this video covers maybe like 20% of what content recruiters want us to know for a junior role. Pretty sad
How can you describing abstract class without saying even word about interfaces? Its the most asked question i think. Also this abstract description is covering max 20% of abstract topic. Nothing about inherritance of abstract classes, abstract methods etc, its really common tricky question
Good for a JAVA tester, but way too easy for any JAVA Dev roles...
what are good interview questions/concepts for Junior Java Dev Roles? I have almost 2 yrs of experience as java tester but its boring and the pay sucks
yes they are very easy
Thank you!