Very well explained. You should get the award for using the best teaching methods, specially for someone new to Java.
@tickmedia39774 жыл бұрын
Hi Naveen I'm from Afghanistan i follow your Java Tutorial , your explain is so good , thanks
@abhisheksagare4 жыл бұрын
Perfect explanation and concept clarification.Loved it.Thanks
@shwetapatil13625 жыл бұрын
Your videos are helping me a lot!! Thanks, Naveen.
@akshaysarve9543 жыл бұрын
Thank you so much Naveen... perfect explanation
@subeshc14265 жыл бұрын
Very very useful. Please post continuously..
@srinathsrinath246 жыл бұрын
Superb Explanation with simple way to understand..
@malanchakalsa3584 жыл бұрын
awsomely explained Naveen , thank you soo much :)
@ribasoul Жыл бұрын
Very well explained Naveen
@Aruthewarrior6 жыл бұрын
Interview question - 1. Some real time example for Finalize...How you have implemented in your framework 2. What will happen if we use System.exit() in catch block. Does the finally block will execute even though ?
@AshishDubeyash4you6 жыл бұрын
Yes it will execute finally block if you use System.exit(0) in try block or in Catch block. package finallyy; public class FinallyBlockConcept { public static void main(String[] args) { int a = 9; int b = 0; try { int c = a/b; }catch(Exception E) { System.exit(0); } finally { System.out.println("Execute Finally Block"); } } }
@arunc83425 жыл бұрын
@@AshishDubeyash4you No bro. finally will not be executed. please try running this code itself. it doesnt run. system.exit will terminate the execution fully.
@sureshsubramaniyan32015 жыл бұрын
Thank you very much for your knowledge sharing
@jayalakshmikrishnan1956 Жыл бұрын
Hi ,Thank you very much for you patient teaching methods. Just one question on finally, i followed you example! For me its not printing the error in sequence, but in your method its coming in sequence ============================================================ public static void Division(){ int i=10; try{ System.out.println("inside try div"); int k = i/0; } catch(NullPointerException e) { System.out.println("Inside AE catch"); } finally { System.out.println("Execute method inspite of exception"); } } ================================================================== My console:- inside try div Execute method inspite of exception Exception in thread "main" java.lang.ArithmeticException: / by zero at JavaBasics.FinallyConcept.Division(FinallyConcept.java:38) at JavaBasics.FinallyConcept.main(FinallyConcept.java:7) ===================================================================================== I think it should 1st display exception and then display Finally comment like this:- inside try div Exception in thread "main" java.lang.ArithmeticException: / by zero at JavaBasics.FinallyConcept.Division(FinallyConcept.java:38) at JavaBasics.FinallyConcept.main(FinallyConcept.java:7) Execute method inspite of exception ===================================================================================== Please Advise ,what could be wrong here!?
@prithadutta46996 жыл бұрын
As usual, Nice explaination...
@khajazakiuddin9316 жыл бұрын
Gud explanation in short duration. Please prepare some videos on SQL.
@madhankumarkarthikeyan47873 жыл бұрын
Nice video, For the benefit of others, The method finalize is deprecated from Java 8+
@naveenautomationlabs3 жыл бұрын
Ita deprecated from java 9. Now we have cleaner class, replacement of finalize.
@himadritanayasahoo46903 жыл бұрын
Thank you so much for an awesome video.. It's really helpful..
@Mr_TravelEatWorship_Official2 жыл бұрын
If you wanna call GC forcefully, finalize() is required 😊
@subhanbasha14 жыл бұрын
Hello Naveen Sir. it is very understandable way of teaching of every concept. Thanks for your efforts for all of us. for finalize concept, am getting displayed "Finalize Method" two times in console for ur mentioned code and why?
@kalyanijoshi68846 жыл бұрын
Programs for Prime numbers and Fibonacci series please add
@praveenac1092 Жыл бұрын
To ellaborate more: The purpose of the finalize() method is to allow an object to perform any necessary cleanup or finalization before it is destroyed. We could use this to release resources such as file handles, network connections, or database connections, as well as performing any other necessary cleanup tasks. Source: OpenAI/ChatGPT 🙃
@ahujabharat192 жыл бұрын
Very Well Explain sir
@Shreysanthu5 жыл бұрын
How to know and verify that finalize is done cleanup processing of the object before garbage collection
@abhishekcardigan37703 жыл бұрын
Naveen, for the first example, even if you do not write inside the finally block it will still execute. I am confused, what is the use of finally in this case? package javabasics; public class Finally { public static void main(String[] args) { // TODO Auto-generated method stub try { System.out.println("inside try block"); throw new RuntimeException(); } catch(Exception e) { System.out.println("Exception handled"); } System.out.println("Inside finally block"); } }
@vaibhavsingh31662 жыл бұрын
yes, it's because you have already handled the exception in catch block if any exception encountered which is not handled in catch block your last print line will not execute without using Finally Block. He just showed for your reference.
@vhvl38885 жыл бұрын
nice ... explain throw and throws also
@naidugaariammai67082 жыл бұрын
nice explanation
@bharatvarshney26666 жыл бұрын
nice explanation between of these
@satyaranjan2k6 жыл бұрын
Hi Naveen, finalize() is getting executed multiple times in my eclipse and it's repeating exactly same nos of times as the nos of objects created. But in your video, though you have 2 objects for the FinalizeConcept concept class, the finalize() is getting executed only once. Below is the code which I have written, Please clarify : package TestCases; public class FinalizeConcept { public void finalize() { System.out.println("finalize method"); } public static void main(String[] args) { FinalizeConcept f1 = new FinalizeConcept(); FinalizeConcept f2 = new FinalizeConcept(); f1 = null; f2 = null; System.gc(); } } O/P : finalize method finalize method
@manikantaraju25926 жыл бұрын
U have created 2objects with 2different reference variable so u are getting output twice. Comment one Object and try to execute it u will get the required output
@jayalakshmikrishnan1956 Жыл бұрын
But example shown in vedio is has 2 objects but still its displaying finalize method only once
@dikshaarora9626 Жыл бұрын
@@jayalakshmikrishnan1956 Happening same with me too . FinalizeMethod output is coming twice
@vivekaanand64443 жыл бұрын
Hi Naveen thanks a lot for video , but when i run this program i'm getting the finally block executed first and then the ArithmeticException divide by zero exception is thrown video timing 18:32
@ramyab69616 жыл бұрын
Thank u so much Naveen.
@bhargavpinnam7336 жыл бұрын
Thank you Naveen!
@bihari14222 жыл бұрын
i am a bit confused with the finalize.....if its a keyword then its color should be changed ...System.gc will look any finalize method present in the class and execute it?
@bihari14222 жыл бұрын
Got it only when we are making the ref variable as null then gc will come into picture and it will look for exactly "finalize" method declared before main and will execute it
@emonyousufy56704 жыл бұрын
Thanks Naveen
@ramadeviarikatla99802 жыл бұрын
Hi Naveen, good evening, I tried with finalize method but i got twice finalize method as the output(2 times printed on the console). Please help me out.
@himanshutyagi32802 жыл бұрын
You must have created two objects
@sridevireddy13716 жыл бұрын
Thank you Naveen
@lisazhou77764 жыл бұрын
very good. thanks.
@bhavanagyarampalli89832 жыл бұрын
Thanku sir
@ujjwalverma77876 жыл бұрын
when I run finalize concept then its give an error Note: finalizeconcept2.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. please some help me to resolve this error !
@seshareddy72546 жыл бұрын
Is Catch compulsory for try block..
@AshishDubeyash4you6 жыл бұрын
No, but if any exception occured & is not caught then JVM will throw error at Runtime.