Top Core Java Interview Questions || Core Java Interview Questions and Answers [MOST ASKED]
HTML-код
- Опубликовано: 1 окт 2024
- In Top Core Java Interview Questions and Answers video you will get top 10 tricky core interview question asked in an interview. Also this video is for both Freshers and Experienced canditates.
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
openinapp.co/u...
Course Description Video :
yt.openinapp.c...
This video covers Top Java interview Questions And Answers asked in MNCs from both Freshers and Laterals,
Which May include some Questions of java interview questions and Answers like :
Q) Why Java is not 100% Object-oriented?
Because of Primitive data types namely:
boolean, byte, char, int, float, double, long, short
we have wrapper classes which actually “wrap” the primitive data type into an object of that class.
Q) Why pointers are not used in Java? Mostly asked in java interview questions and Answers in MNC to check you basic knowledge of java and programming languages and logics behind them.
Because :
1) They are unsafe.
2) Increases the complexity of the program and since Java is known for its simplicity of code, adding the concept of pointers will be contradicting.
3) Since JVM is responsible for implicit memory allocation, thus in order to avoid direct access to memory by the user, pointers are discouraged in Java
Q) What is JIT compiler in Java?
Q) Why String is immutable in java?
1) String pool requires string to be immutable otherwise shared reference can be changed from anywhere.
2) security because string is shared on different area like file system, networking connection, database connection , having immutable string allows you to be secure and safe because no one can change reference of string once it gets created.
Q) What is a marker interface?
A Marker interface can be defined as the interface having no data member and member functions. In simpler terms, an empty interface is called the Marker interface.
Q) Can you override a private or static method in Java?
As I have told you in previous videos : method overriding is a good topic to ask trick questions in Java.
1) you can not override a private or static method in Java.
2) you cannot override a private method in sub class because it's not accessible there, what you do is create another private method with the same name in the child class.
3) For static methods if you create a similar method with same return type and same method arguments in child class then it will hide the superclass method, this is known as method hiding.
Q) Does “finally” always execute in Java?
Not in following cases
“System.exit()” function
system crash
Q) What Methods Does the Object Class Have?
Java.lang.Object class, parent of all has following methods :
protected Object clone() throws CloneNotSupportedException
Creates and returns a copy of this object.
public boolean equals(Object obj)
Indicates whether some other object is “equal to” this one.
protected void finalize() throws Throwable
Called by the garbage collector on an object when garbagecollection determines that there are no more references to the object.
public final Class getClass() : Returns the runtime class of an object.
public int hashCode(): Returns a hash code value for the object.
Q) How Can You Make a Class Immutable?
Q) What is singleton class in Java and how can we make a class singleton?
This is always been a part of core java interview question :
Equals and Hash code Contract
Its working and many such interview questions and answers will be covered in this video,
we will create more such videos on java interview questions and Answers on our channel.
Udemy Course by Code Decode(Free)
www.udemy.com/...
Code Decode Playlists
Most Asked Core Java Interview Questions and Answers : • Core Java frequently a...
Advance Java Interview Questions and Answers : • Advance Java Interview...
Java 8 Interview Questions and Answers : • Java 8 Interview Quest...
Hibernate Interview Questions and Answers : • Hibernate Interview Qu...
Spring Boot Interview Questions and Answers : • Advance Java Interview...
GIT : • GIT
Subscriber and Follow Code Decode
Subscriber Code Decode : www.youtube.co...
Linkedin : / codedecodeyoutube
Instagram : / codedecode25
#JavaInterviewQuestionsandAnswers #JavaInterviewQuestions #Intellipaat #JavaInterview #CoreJavaInterviewQuestions #JavaInterviewQuestionsandAnswersForExperienced #JavaTutorial #JavaProgramming #JavaTutorialForBeginners
Thanks for making such informative videos. I am preparing for interviews and your channel is helping me alot. I will let you know after I crack my interview 😊
i will be waiting for that :) hope to hear from you soon 👍Alll the very best 👍👍
@@CodeDecode thanks
All the best
what happen have u selected or not?
That's a great news Manish... We really wish you all the best for your future....
1.why java is not 100% object oriented?
2.why pointers are not used in java ?
3.what is jit compiler in java?
4.why string is immutable in java?
5.what is a marker interface?
6.can you override a private Or static method in java?
7.Does finally always execute in java?
8.what methods does the object class have?
9. How can you make a class immutable?
10.what is singleton class in java and how can we make a class singleton?
😊
Thanks for making such videos. These videos are very helpful for interview preparation.
I would like to correct you on one question mentioned in the above video related to JIT compiler. The probable accurate answer to it would be below answer.
When a Java program is executed, the JVM interprets the bytecode one instruction at a time. This process is relatively slow, because each bytecode instruction must be interpreted by the JVM. However, when the JVM encounters a loop or frequently executed code, the JIT compiler compiles that bytecode to native machine code and caches the result, so that subsequent executions of the same code can be executed more quickly.
singleton-
public class Singleton {
private static Singleton instance;
private Singleton() {}
public static Singleton getInstance() {
if (instance == null) {
instance = new Singleton();
}
return instance;
}
}
Singleton singleton = Singleton.getInstance();
// Do something with the singleton object
Omg I watched your video today morning before my interview I got exact same questions from this thank you ❤️
Been there on the candidate seat many a times Rohith 🙂. That's why we know what will be asked mostly 😁👍, hope u got cleared and got the job. All the best Rohith keep learning keep rocking man 👍👍
Had been workin in an IT firm for over 2 years, made an attempt to switch for better prospect and hike. Cleared th coding round but failed the interview miserably. Had I came here before, things could have been different 💔.
Thanks for making such videos. I have a better understanding now. Thank you
may be interviewer also watched the same video so to decide which questions to ask in interview 😂😂
@@abhishekseth8008 😂😂may be.
@@abhishekseth8008 😁😁😁😅😅😆
very irritating voice and accent, I wanted to listen it till last but could not bear it till end so dropping off this video
take breath while explaining plz....its just sounds that you are reading newspaper or i m listening it in 2x speed...
sure, you can reduce speed to 0.5 X or something, We are just trying to cover as much as possible in less time because before interview, time matters
I had an interview 2 days ago and Immutable class, singleton, Finally, Method Hiding, Java is pure object oriented or not? This questions were asked, I came here just to check different questions for my upcoming TCS Interview 🤗, Wish me Luck, BTW Thanks For this video 💙
ruclips.net/p/PLyHJZXNdCXsfqAkteaQ6JfZ_IHvxX-Hj3
This is almost all what u need Shivam👍. All the very best 👍👍 Prepare well 👍👍
Thanks, I'll cover all the videos that present in this playlist, i already completed 6 video from it, it's kind of quick revision of Java as well as some Boosters that will help to crack the interview for sure 💙😊
All the very best Shivam 🙂🙂👍👍.
Java is interpreted language, right?
Then why is there a compiler interpretation problem... so is java semi- interpreted language
Java has JIT compiler added to increase the speed to translation
Great Content & precise explanation! These are all the questions I faced in the interviews. It really helps me & boosting my confidence! Thanks a ton!
Thanks priyanka 👍👍. M glad it's useful . Keep learning keep growing 👍👍
Thanks to whole team. Because of your tutorial and important guidelines. I had cracked the 3 companies with satisfied package.
Many congratulations Sai. 👏👏👏👏well deserved Man. You really worked hard to achieve this milestone. 👍👍🙂🙂👏👏👏👏👏
www.youtube.com/@onlyinterviewquestions/shorts
I am creating some nice content for Java interviews. Could you please review. Appreciate your feedback
Your videos are amazing. it is helping me a lot for interview preparation. I liked subscribed your channel.
Thanks a lot Kiran 🙂👍👍
please keep the background of your slides dark/black as its uncomfortable for someone people to watch on light/white background
I am a mechanical engineer and I have a desire to switch into IT industry, I am learning core Java as one of my friends suggested it. to understand all these exhaust me and after a while I am back on it again.is there any chance this industry could give me entry level opportunity?
Purpose: JIT compilers aim to improve program performance by compiling frequently executed parts of code into native machine code at runtime.
Hi mam
"Shiva is a person " in this statement whicj one is object and which one is class
Person can be considered as a class and Shiva can be one of the instance of that person class
@@CodeDecode tq mam
👍😊
Thank you so much for these videos. Helped me crack 2 of the 3 interviews I attended. I'm joining next week.
Thanks a lot ❤️
congrats
That's such a great news Jeeja. Many congratulations to you. Keep Shining ⭐✨⭐✨⭐✨ girl
Congratulations
Thank you so much ma'am. I am referring all your Videos since last one month and I have cracked interviews of TCS, LTI, HCL, Wipro, HSBC. Received a much better offer than I expected. Thank you so much ☺️ god bless you ❤️
how u prepare to crack it can u tell me plz..
Many congratulations Priya. Well deserved Girl. 🎊🎊🎉🎉🎉keep learning keep growing . So proud of you🎊🎊🎊🎊
@@CodeDecode Thank you so much ma'am for such a love ❤️ keep motivating us ☺️☺️
@@iampacific352 I was very afraid at the beginning but then I started giving interviews... Almost every call... Then made a question bank of all questions.. and now after one month I already knew what the interviewer is going to ask ... ☺️☺️ It's fun.. just start and make a question bank.. and at the you can crack any interview. All the best 👍
Nice suggestion Priya! M glad you are not just focusing on shining alone, but pulling others too with you. Glad to see this ❤❤🙂🙂👍👍👏👏🎉🎉🎉🎉
Singleton is one instance in one JVM.
So if I run the same program twice or thrice in a single JVM, there will still be only single instance?
Yes
Hi
I have a doubt, if Jit compiler converts byte code into machine executable code efficiently then why again interpreter should be there in the JRE. please clarify.
I hope this video will help me to get placed in MNC which I am going to attend interview 😁 and your voice is very nice, helping to learn more 😁😁
Hi Karthik, did you get offer?
Mam aap hindi main padhaya karo
Thanks buddy, i got 7L package
Great all the best for your future 😊😊
@@CodeDecode 🫶🙏
What company bro ? Any interview questions please share
Kam hai bahut
@@GyanSingh-u9m2uTera hain kya 3 ka bhi nahi hoga tuzko package logo ko nam rakhta Hain
CAN YOU MAKE A VIDEO ABOUT FULLY JAVA INTERVIEW TOPICS WHICH WILL IMPORTANT ?
Hi. Method hiding - "If a subclass (child class) defines a static method with the same signature as a static method in the superclass (parent class), the subclass method conceals the one in the superclass". Method hiding occurs because static methods are resolved at compile time. Please, replace "same return type" with "same signature".
👍👍
Q) How to make the class immutable, if there are collection variables in the class, they.n there is an extra step to make them read only
public, private, protected are called access modifiers, then what are static, non-static are called? And what is the difference between access specifiers and access modifiers?
Static is a key word in java
No difference at all. They are the same 🙂
thanks a lot for explaining all the Questions in such a great way ..
Thanks gajanan 🙂👍
Pls back your theory with a small coding example then It would be more helpful
Sure Pradipta. We have done that all in next videos 👍🙂
Method hiding violate the Liskov substitution principle, remember that. And also violates that principle if a method implementation doesn't what is supusted to do the interface or parent class. Easy axample, you have an interface called Vertebrate with a method Integer numberOfBones() and want to use classes implemented it. Is not valid to return zero bones, because it suposed to have bones. That simply is.
Interfaces markers are recomended to avoid it. Doesn't bring any information about the object
Nice but it would be great if you could add examples of code while explaining it.
Hi Asad,
Please check other videos where we have explained using examples ...
I am unable to understand the JIT complier
It is used to enhance or optimize the task of executing the bytecode, the parts of programs that are frequently executed, are executed by jit compiler as interpreter is slow because it interprets program line by line
Its very helpful, still I would request you if you can provide a pdf , otherwise also its fine.
Can you please provid collection related interview questions
This is the link for the video you require
ruclips.net/video/KfoNYoVUBJI/видео.html
Like seriously these are concept making questions that work like blueprints to learn and differencing any language to other one.. hats off mam ❤️
Thanks Sidra 🙂👍
www.youtube.com/@onlyinterviewquestions/shorts
I am creating some nice content for Java interviews. Could you please review. Appreciate your feedback
surely the questions you have selected in this video are all very important, thanks for making such an informative video.
Thanks Shameem 🙂👍
www.youtube.com/@onlyinterviewquestions/shorts
I am creating some nice content for Java interviews. Could you please review. Appreciate your feedback
Can you provide me the source link for ppt materials?
You have fabulous speech🎉 of course great content as well. Outstanding.. Keep uploading ❤
My sister got Job because of this video
Plz upload more videos like this 😻
Congratulations to your sister Sai🎉🎉🎉🎉. All the very best for the new job. Keep Rocking 👍👍
Sure Sai, we will post more such videos 👍👍
Most imp questions collected thanku for the exlanation
Thanks 🙂🙂
Are all these notes and question/answers from CDAC? Any chances of that?
Just asking out of curiosity!
You have done a great job with this video 🎉
Nope. These are questions asked to our team members in their IT career.
Hmm but since pointers are not used in java and the questions are about core java, does it really make sense to ask about pointers.
I never had anything to do with pointers cause in my languages I use they don't exist.
So why should I know about them?
In interviews you will face many many such questions that you won't use in every day life. But they ask. You won't answer, they won't select you. It's like being frog in a well. Take a leap man. IT is no more a place to be in cocoon. Learn stuff. You have capabilities. Learn n Shine ⭐✨
Thank u mam for covering these all questions .. one of the best video on java 👏..
Thanks a lot 😇😇👍
Thank you @CodeDecode..I just recently got opportunity in company for lead role in just a month and I am having 5 years experience only..it's kind of achievement in my organization..please keep post videos with same enthusiasm. Thank you 🙂🙏
That's awesome Priyanka. Congratulations 🎉🎉🎉🎉🎉. Keep working hard , you will reach all the heights very soon 🙃
Madam plz give me some tips.. Plz
Thank you so much for making very informative videos. I am able to crack interviews and got 3 offers in hand.. thank you so much
Many congratulations Kuntal 🎊🎊keep learning keep shining Girl ⭐✨⭐✨
Mam, you said you can call the static method by creating an object also, but you should not call like that, means is there any reason for not calling like that?
You can call static methods with class name hence you don't need to waste memory creating the object and then calling static methods. But that doesn't mean you cannot call the static methods the object. Interviewers usually trick you by asking this and people usually answer that error will come or you cannot call static methods with object.
@@CodeDecode ok thanks
Thanks team for the wonderful work, it really helps.
Di you are the best, hardly there are people who can explain the way you can explain I have learnt so many things because of u. Di but I have one request if u start DSA related series there is no one other than you have the ability to make us understand those hard algorithms in simple way on whole RUclips world. It will really help everyone if u too enter into DSA training
Thanks Pallavi. Sure will take that in count👍
I'll have interview on Saturday and I've been to many as well but they all have different questions for this role. These questions were never been asked but I'll try to study this still.
ruclips.net/p/PLyHJZXNdCXsfqAkteaQ6JfZ_IHvxX-Hj3
Just one video will not cover all possible java questions Pb Bodino. Please prepare well 👍👍
Thank you so much team Code Decode , your videos were a huge help to prepare for interviews ,truly grateful for your videos ,wishing you all the success you aspire
Thanks a lot 🙂🙂👍👍. Keep learning keep shining 🌟🌟🌟🌟
"Does finally always execute in java" ? Mam my doubt is this...finally is a block not method
Nice video but can be improvised. The answer for singleton was not completed, you can add the impact of multithreading on getInstance method.
This is the part 1 of Core Java. Many more are yet to come. We will cover that in those parts. Please stay tuned.
Wow ... Wednesday Eve i am having an interview.. thanks a lot fr this clarity ❤
All the very best 👍👍👍👍 do well.
How to call java methods/classes (eclipse based maven project) to .Net framework (C# code)
For a sec i thought how my Windows isn't activated
Padhai kr n tu bachodi kyu kar raha hai🤡
Question 3:- why string is immutable ?
Answer :- the very correct answer i found from different source -> because of hashing related collection , key takes as string , so string is immutable . [correct me if im wrong ]
Thanks a lot. Is there a way you can share you ppt slides that you are using? That would be really helpful in going back revising after watching you videos
I started watching before some days only but i like the way you describe.
Please if there is any session on ejb , it will help to understand
Sure Shivani, we will do that 👍🙂
Perfect explanation..thanks for all your videos which is really helpful...can you post something on Java threads please.
Sure. Will create a video on threads too 👍👍
Thanks ma'am Very Appropriate Interview Questions and Answers.
Thank you so much for this series.. It helped to get me job at CITI
You're welcome Shivani and all the very best for your future endeavours
I did not get the point of JIT compiler, it compiles and not interprets, I didn't get that point, can u please elaborate just the last bit of your JIT segment.
Sure will create seperate video on architecture of jvm jre. It will be easy to understand there for u.
What happens when we call system.exit() method after the finally block? Will it execute finally block?
As soon as u call system. Exit() nothing will be executed after that Paru👍
In depth knowledge is required to answer these kind of questions 🤨🤨🤨🤨😞😞😞
How can we help you Shiva?
Great. Nicely explained without any kind of nonsense
Thanks Naveen 🙂👍
Tanks for ur Video.. its very helpful to prepare For interview so do more interviews videos
Sure 👍 thanks 👍👍
Could you please elaborate about Hit compiler. Based on what you said the jit compiler takes bunch of byte code and convert or compile to machine code to boost up the performance. So the doubt is does the interpreter has no role in the JRE
JIT is nothing but interpreter
@@nidhipatil7187 JIT is a complier right? not an interpreter.
Marked interface basically provide some ability to the object and marked interface doesn't contain any method
👍
thanks for such important video i cracked my interview and urs video helped alot ty so much for such efforts and making it free for us
Thanks Akanksha. Many congratulations on clearing your interviews🎉🎉 keep learning keep shining 🌟🌟
What will be answer to this Question: How to find the values of an arraylist without using loop or iterator? please answer.
What is abstraction and where you used in your application? 7yrs exp candidate how well can he answer this question. What is the answer interviewer is expecting
Maam,very good explanation with basics , thank you so much maam
You are welcome pavan....
I think you know Hindi also so can you make videos in Hindi also it will help to understand clearly.
Sure 😊👍
I have a question Q) Can I create my own marker interface ? an interface with no methods in it
for example if I create interface a public interface MyOwnMarkerInterface{ } will it be consider as a marker interface? can now the MyOwnMarkerInterface will behave same as Cloneable or Serializable
pl. provide detail answer... Thank you
No Gokul. Jvm should understand it's functionality. Jvm don't know your myownMarkerInterface.
@@CodeDecode Yes! I Agree with your answer but then is the interface "MyOwnMarkerInterface" will be consider as marker interface because as per definition, any interface who does not have any method in it then it is called as marker interface , Actually the definition should be
like this any java library interface provided by java that does not contain any method should be called as marker interface , any user define interface that does not contains any method should not be consider and can not be treated as marker interface. pl. correct me if I am incorret
Thank you dear for such a great video.. Very helpful to brush up your skills.. ❤
Thanks Dipali 🙂👍
Amazing 😊
Thanks
Awesome Explanation, Thank you so much for sharing this useful knowledge for interview purposes.
Nice content..can we get pdf of all these questions and answers..thanks
When to use abstract class and when to use an interface ? Could you please let me know?
hey bro here it is. An abstract class allows you to create functionality that subclasses can implement or override. An interface only allows you to define functionality, not implement it. And whereas a class can extend only one abstract class, it can take advantage of multiple interfaces
Nicely said Sai 👍👍
Very helpful, clear, to the point and nice content. Please try to make video on Serialization and Multithreading concepts also.
Sure we will create video on that soon 👍👍
Most helpful video for interview as well as personal learning purpose.Voice is as clear as the explanation. Sabse Pehle at 14:29 😄
Thanks...
www.youtube.com/@onlyinterviewquestions/shorts
I am creating some nice content for Java interviews. Could you please review. Appreciate your feedback
nice explanation mam , am background from php from last 6 year now just started
learning Java . this is good start for helping me and others , thank you.
Thanks 😊
I can't understanding what topic is going in the video I was watching about java but in this video what questions discussing also n't understanding to my mind
Sorry sir what are you expecting from a Java interview series ? Can you explain what you need specifically? We cant understand what you want.
May be we need to learn Java a bit more Sir
Really Useful
I have a doubt, What is the difference between Immutable class and Singleton class
I Guess cannot extend immutable like final and one instance in case of Singleton
Hi , one question regarding static method overriding, you mentioned parent class method is hidden? It depends on reference type Right?
In static, nothing depends on objects or reference bcz they gets memory at runtime. Static is related to compile time
Really helpful.... I never seen these kind of vedios earlier.... Really appreciate your great work mam..... Please keep on gng.... Thank you so much .......
Thank you so much Mam!! I have one doubt here on JIT compiler , I read somewhere JIT is use for repeated line/block of code so it enhance performance ..Its just doubt
Hello code decode
I have an interview on wednsday on 6/22/2022
@mahharish university masters programme
Please tell me what to do.
I was studying little bit before seeing this videos but its make me to think what to know . Best video
Thank you so much wait form u more
Yes I have a doubt
So I have read that JIT compiler will increase the efficiency of interpreter.
Interpreter will read code line by line , interpret it and then execute it. And If same method calls again It will again interpret and execute it
hence , JIT compiler will create native method for that part and same method calls again then It will use that native method for that part.
and also native methods are those methods which are in non java langauge.
So, Is JVM using another language also internally?
Am I thinking right ??
Just let me know and If not, kindly correct me please.
Straight to the point. Clearly explained. Thank you so much.
M glad you liked it
www.youtube.com/@onlyinterviewquestions/shorts
I am creating some nice content for Java interviews. Could you please review. Appreciate your feedback
Superb coverage !!! ... Can i get these questions compiled in single document? It will be great help...
Sure we will provide it soon 🙂🙂
Straight to the point, lot of information covered and it's quite useful for interviews.👍
Thanks Priya 👍
Nice set of questions. Thanks ❤
Thanks
Can we overload static method in java ? please reply
Yes
@@OracleLand_Official thank you 😊
out of all this questions 6 questions were asked in my DP World interview. I would have known this channel earlier. My bad
Hey could you please help me out I love Java language ,my concept is crytral clear on each and every topic but when I come to solve some problem or else implements on that point I don't able to solve it quickly or some time I felt I am not born for coding please suggest?
Thank you for the questions, highly appreciate.
But just one thing around JIT compiler, you just mentioned it compiles bunch of code, if that is the only answer then why interpreter is in place, Why not JIT take over and do the whole compilation rather than interpreter..?
there must be something more to that bunch of code you mentioned...& that is what an interviewer will ask as a follow up question
Can you please clarify
Hi Ankush. So java is by default an interpreted language which makes it slow in performance. So what java people did to improve the performance is to add JIT compiler along with the interpreter so as to decrease the time taken to convert byte code to machine code. Does that answer your question?
@@CodeDecode so, now only JIT compiler is being used and the interpreter that you mentioned in the video is no longer used?
Please create Core Java, Collection, Spring, Spring boot, Restful webseries and microservices interview questions for 6+ years experience.
I have covered most of them. Please have a look at the playlist
Advance Java Interview Questions: ruclips.net/p/PLyHJZXNdCXsexOO1VQ4vs-BM2-8CKrixd
And this for
Core Java frequently asked Interview Questions and Answers: ruclips.net/p/PLyHJZXNdCXscoyL5XEZoHHZ86_6h3GWE1
In 2 nd question , are we compiling code two times?
Thank u mam
Can you please make videos on new features in Java 8
This is the link for the required videos :
ruclips.net/p/PLyHJZXNdCXsdeusn4OM33415DCMQ6sUKy
This is the playlist for interview questions in Java 8