Wish to have some nice time? Check out what I'm reading online!

Core Java

Explain the Java Static Modifier

Static Variables or Class Variables Java instance variables are given separate memory for storage. If there is a need for a variable to be common to all the objects of a single java class, then the static modifier should be used in the variable declaration. Any java object that belongs to that class can modify its static [...]

Difference between static and non-static java inner class.

A static java inner class cannot have instances. A non-static java inner class can have instances that belong to the outer class.

Can a java subclass declare a private method available in its java superclass?

Yes. A java private member cannot be inherited as it is available only to the declared java class. Since the private members cannot be inherited, there is no place for discussion on java runtime overloading or java overriding (polymorphism) features.

When does the finally clause in java exception block never executes?

The finally clause in the try-catch exeception block always executes, irrespective of the occurence of exeception. This is applicable for the normal java program flow. If the execution flow is stopped irreversibly before the finally clause, then the finally block will not be executed. How can the user achieve that in Java? Include “System.exit(1);” before the [...]

Java Pass By Value and Pass By Reference.

Pass by value in java means passing a copy of the value to be passed. Pass by reference in java means the passing the address itself. In Java the arguments are always passed by value. Java only supports pass by value. With Java objects, the object reference itself is passed by value and so both the [...]

Can an unreachable Java object become reachable again?

Yes. It can happen when the Java object’s finalize() method is invoked and the Java object performs an operation which causes it to become accessible to reachable objects.

Java finalization

Finalization is to give an unreachable Java object the opportunity to perform any cleanup processing before the Java object is garbage collected. It happens when the Java object’s finalize() method is invoked.

Java garbage collection

Garbage collection in Java is to discard objects that are no longer needed and to reclaim their resources. A Java object is subject to garbage collection when it is out of scope of the control flow of the program.

Does Java garbage collection guarantee that a program will not run out of memory?

No. Java Programs may use up memory resources faster than they are garbage collected. A Java program can create objects that are not subject to garbage collection.

Difference between a Java interface and a Java abstract class?

Methods of a Java interface are implicitly abstract and cannot have implementations. A Java abstract class can have instance methods that implements a default behavior. Variables declared in a Java interface is by default final. A Java abstract class may contain non-final variables. Memebers of a Java interface are public by default. A Java abstract class can have the usual flavors [...]