![]() ![]() ![]() Creating a class instance means allocating memory to store the data of the class variable. To use a class, a class object has to be created. Save my name, email, and website in this browser for the next time I comment.An object is a class type variable or class instance. Your email address will not be published. That’s all about core java interview questions. It is generally used to do some clean up work.įinalize : Finalize is a method is used to invoke garbage collection for clean up unreachable object but it is not guaranteed that when you invoke System.gc(), garbage collection will definitely trigger. Finally block executes even if there is an exception. 50.What is difference between final, finally and finalize in Java?įinal : Final is a keyword which is used with class to avoid being extended, with instance variable so they can not reassigned, with methods so that they can not be overridden.įinally : Finally is a keyword used with try, catch and finally blocks. This method can be used to write clean code before object is collected by Garbage Collector. What is use of finalize() method in object class? Finalize method get called when object is being collected by Garbage Collector. gc ( ) , garbage collection will definitely trigger. This method is used to invoke garbage collection for clean up unreachable object but it is not guaranteed that when you invoke Garbage Collection is a process of looking at heap memory and deleting unused object present in heap memory. What is difference between JVM, JRE and JDK ? You can compile program in Windows and can run it in Unix. You can write and compile program in one Operating system and run in other operating system. What do you mean by Platform independence of java? 50.What is difference between final, finally and finalize in Java?ġ.What is use of finalize() method in object class? What is the difference between creating String as new() and literal? Can you call wait, notify and notifyAll from non synchronized context? Why wait, notify and nofiyAll method belong to object class ? What is difference between CountDownLatch and CyclicBarrier? ![]() Can we call run method directly to start a thread? What are differences between Sleep and wait in java? What are ways to create a thread in java ? 35. Can we have try without catch block in java ?.34.What is difference between Checked Exception and Unchecked Exception?.How do you create custom exception in java? What are differences between ArrayList and LinkedList in java? How do you sort Collection of custom objects in java? Do we have lock while getting value from ConcurrentHashMap? Can you explain internal working of ConcurrentHashMap in java? What are differences between HashMap and HashSet in java? Can you explain internal working of HashSet in java? What if you don’t override hashcode method while putting custom objects as key in HashMap? Why java uses another hash function internally to calculate hash value apart from hashcode method which you have implemented? Can you explain internal working of HashMap in java? What are methods you should override when you put an object as key in HashMap? What is difference between StringBuffer and StringBuilder in java? Difference between path and classpath in java? Can you override private methods in Java? What is method overloading and method overriding in java? Can one interface implement another interface in java? What is difference between Abstract class and interface? What are access modifier available in java? Why String is declared final or immutable in java? What are some core concepts of OOPS in Java ? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |