Tag Archives: J2SE

How many ways can we make an object eligible for GC?

How many ways can we make an object eligible for GC?

How many ways can we make an object eligible for GC? Even through programmer is not responsible to destroy useless objects it is highly recommended to make an object eligible for GC. If it no longer a requirement. The garbage collector will look for objects which aren’t being used anymore and gets rid of them, freeing up the memory so ...

Read More »

What is synchronization and why it is important?

What is synchronization and why is it important?

What is synchronization and why it is important? Synchronized is the modifier applicable only for methods and blocks but not for classes and variables. If multiple threads are trying to operate simultaneously on the same java object then there may be a chance of data-inconsistency problem. To overcome this problem we should go for the synchronized keyword. If a method or block declared as ...

Read More »

Explain thread priority and what is default thread priority?

Explain thread priority and what is default thread priority?

Explain thread priority and what is default thread priority? Every thread in java has some priority. It may be default priority generated by JVM or customized priority provided by the programmer. The valid range of thread priorities is 1-10. where 1 is min priority and 10 is the max priority. Thread class defines the following constant to represent some standard ...

Read More »

What is finally block in Java?

What is finally block in Java?

What is finally block in Java? It is not recommended to maintain cleanup code inside try block because there is no guarantee for the execution of every statement inside the try block. It is not recommended to maintain cleanup code inside the catch block. Because if there is no exception then catch block won’t be executed. Hence we required someplace ...

Read More »

What is the checked and unchecked exception?

What are the checked and uncheched exception?

What is the checked and unchecked exception? The exceptions which are checked by the compiler for smooth execution of the program are called checked exceptions. In our program, if there is a chance of raising checked exception then compulsory we should handle that checked exception either by try-catch or by throws keyword otherwise we will get compile time error. Unchecked ...

Read More »

Explain Default exception handling in Java?

Default exception handling in Java ?

Explain Default exception handling in Java? Inside a method, if any exception occurs the method in which it is raised is responsible to create exception object by including the following information. Name of exception Description of exception Location at which exception occurs(Stack trace). After creating exception object method handover that objects to the JVM. JVM will check whether the method ...

Read More »

Responsive WordPress Theme Freetheme wordpress magazine responsive freetheme wordpress news responsive freeWORDPRESS PLUGIN PREMIUM FREEDownload theme free