Top 10 Static & Instance Block Based Interview Questions || Tricky Java Interview Questions

preview_player
Показать описание
In this video, I have covered different Static Block Based Interview Questions || Tricky Java Interview Questions

--static block
--instance block

/**
* Java Static Block Interview Questions:

Q1. Explain static blocks in Java ?

Q2. How can we run a java program without making any object?

Q3. Similarity and Difference between static block and static method ?

Q4. How can we create objects if we make the constructor private ?

Q5. Is it possible to compile and run a Java program without writing main( ) method?

Q6. Can we initialize member variables within static block ?
*/

~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:

Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:

Naveen AutomationLabs Paid Courses:
Java & Selenium:

Java & API +POSTMAN + RestAssured + HttpClient:
Рекомендации по теме
Комментарии
Автор

These are the most common nd Basic part of java
But people are confusing about it. Nd u explained it very Simply way. Thanks Naveen 😊

nirmal
Автор

15:00 It's because of the "final" keyword.
If X was only static and not final, the static block would be called.

Explaination in a layman's terms would be, if a variable is static and final, it means that it's shared between all objects and it's value cannot change, hence the compiler will simply put it's value in the calling statement instead of referencing it from the original class.
If it was not final, means the value of x is changeable, therefore directly putting the value in the calling statement could cause inconsistencies.

ShinAkuma
Автор

One of my favourite teacher, who used to give concepts from scratch . 🙏🙏

nikeshkumar-glfv
Автор

11:49- the question is run program without writing main method but you executed program inside the main method by creating object.

bollywoodssongs
Автор

Okay this is the first time I heard of such things..

AdamantMindset
Автор

Awesome questions my friend 🤗.even in clg they won't teach this hidden techniques

m.smanoj
Автор

Awesome.... Everytime there is a video by you, I learn something new

SumitSharma-qqhk
Автор

Overall explanation was good but I didn't find the answer for below things :
1. If Constructor is Private and I am writting a object creation in static block how I can use it outside class
2. Can I run the code witout Main() method, of yes I think you could have given one example in one class without main method instead of calling a second class where main method is not there
But again sir big fan, always love your content.Please keep on doing your good works and help others to upskill there knowledge

munich-germanylife
Автор

Thanks Naveen..👍👍it's really helpful..pls continue such type of interview questions series

vibhanidhi
Автор

Naveen, a great series. One doubt. In question 4, the question is to run a Java program without main() method. You have created a class without main method but called that class from another main method only, isn't it?

ahamedabdulrahman
Автор

Perfect series for interview preparation...👌

saikigaj
Автор

This is really very useful..Completely cleared my doubts. Thanks a lot for making such awesome videos.

niloybasu
Автор

I have a very simple question.
But before asking that I must appreciate the way you explained these super-10 questions.... Absolutely heavenly ...

coming to my question,
Sir may you please tell me the practical application of the static block and the instance Inisialisation block in a real world situation. An example describing both of these applications would help me a lot.

soumyanetrapal
Автор

no more confusion on static block....thank u myguru....!!!!

harekrishnasingh
Автор

Pls continue this type of interview questions

m.smanoj
Автор

Naveen I can't thank you enough👍
Keep creating more and more
your daily videos motivates me to learn further more
Naveen, one more thing recently I came through a string question and I tried to do it on my own
but Expected output is not coming I'll paste question here do give me a solution Naveen if you Know
QUESTION :
" Welcome to Java and Python "
Replace first 2 letters of each word in given string with number 12
EXPECTED OUTPUT:
" 1212lcome 1212 1212va 1212d 1212thon "

vinith
Автор

Hi Naveen, i am curious to understand where exactly a static block can be used in a framework design and how it will serve the purpose. Also a request when you explain the concept please explain where exactly it will fit in framework. It will help us to create better framework.

arunprasath
Автор

Amazing explanations sir, I am really fortunate to find such great content in YouTube.

palspal
Автор

Really great work sir, ..ameerpet, Hyderabad mein venkatesh sir bolke ek sir hai..yeh poora bolthe thei, as per the interview's going on..aap unki yaad dilaadi hai..thank u :):)

baazishaik
Автор

Hi Naveen, Thanks for such helpful videos. I have started my career as a manual tester n now moved to automation by watching your videos.

One question: how to take a screenshot of full page is one go(e.g there is one page where we need to scroll, wo how to take single screenshot of that page)?

nikitagade
join shbcf.ru