Monday, 18 March 2013

What is final, finalize() and finally?


What is final, finalize() and finally?  
final : final keyword can be used for class, method and variables. A final class cannot be subclassed and it prevents other programmers from subclassing a secure class to invoke insecure methods. A final method can’t be overridden. A final variable can’t change from its initialized value. finalize() : finalize() method is used just before an object is destroyed and can be called just prior to garbage collection. finally : finally, a key word used in exception handling, creates a block of code that will be executed after a try/catch block has completed and before the code following the try/catch block. The finally block will execute whether or not an exception is thrown. For example, if a method opens a file upon exit, then you will not want the code that closes the file to be bypassed by the exception-handling mechanism. This finally keyword is designed to address this contingency.

Blog Author: Vijay Kumar


What is UNICODE?


What is UNICODE?  
Unicode is used for internal representation of characters and strings and it uses 16 bits to represent each other.



Blog Author: Vijay Kumar

What is Garbage Collection and how to call it explicitly?


What is Garbage Collection and how to call it explicitly?  
When an object is no longer referred to by any variable, java automatically reclaims memory used by object. This is known as garbage collection. System.gc() method may be used to call it explicitly.

Blog Author: Vijay Kumar


What is finalize() method?


What is finalize() method?  
finalize () method is used just before an object is destroyed and can be called just prior to garbage collection.

Blog Author: Vijay Kumar


What is method overloading and method overriding?



What is method overloading and method overriding?  
Method overloading: When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding : When a method in a class having the same method name with same arguments is said to be method overriding.


Blog Author: Vijay Kumar