Anonymous inner classes in Java. What and Why?

Anonymous inner classes in Java. What and Why?

What is Anonymous inner classes in Java? Anonymous classes are classes which are "anonymous" in nature. Anonymous means they don't have any name. Anonymous classes and anonymous inner classes are same as the anonymous classes are always "inner" classes. Anonymous classes can be created in different ways. From a class…continue reading →
4 things to remember on autoboxing and unboxing

4 things to remember on autoboxing and unboxing

In the previous post Autoboxing and unboxing in java we have discussed that feature which is introduced in jdk 1.5. And we saw it is a very relevant and convenient feature for developers as the compiler is able to "box" and "unbox" automatically on requirements. Now we can look into…continue reading →
Autoboxing and unboxing in java

Autoboxing and unboxing in java

Autoboxing and unboxing; these terms came into the world of java from jdk 1.5. Perhaps this is one of the feature every developer uses in their every day "coding life" without knowing about it. So in this article we will discuss about this "always used still unknown" feature. We know…continue reading →
What is static import in Java

What is static import in Java

What is static import in Java? Before going to the specific answer of our topic, we can go through the feature "import" in java. Before the world of "import" We all know that java uses packages to categories classes and interfaces. Packaging gives a convenient way for namespacing of the…continue reading →
Variable Shadowing in Java

Variable Shadowing in Java

In the previous post can we override static method in java? we saw that methods in java classes can be override(or hide in case of static method). Now we will see whether it is possible to hide a variable. Hiding a variable is also called shadowing. A variable can be…continue reading →
Fields vs Variables in Java

Fields vs Variables in Java

What is a field in java? One of my friends asked me this question few days back. I know everyone knows the answer. I too did. Then he asked What is the difference between 'variable' and 'field' in Java? I didn't expected that question at all. Actually that question never…continue reading →
Can we override static method in java

Can we override static method in java

Can we override static method in java? This is an interview question asked frequently to junior level developers. So this time we can try this out and reach to an answer. The one word answer to this question is No. why? what happens if we create a method with same…continue reading →
checked and unchecked exceptions in java

checked and unchecked exceptions in java

What is the difference between checked and unchecked exceptions in java? This is another famous interview question. Well!! before looking into checked and unchecked exceptions we need to look into Exception class itself. What is an Exception The java documentation gives a definition to Exception. Exception is an event, which…continue reading →
Difference between ==  and equals()

Difference between == and equals()

Difference between equals() and == is another famous interview question like Why String is final in Java. Lets check what is the difference by writing some code. [crayon-58b730bcbbe01372938409/] Here we have defined two variables s1 and s2 and both of them carries same value java. Ok, lets try to find…continue reading →
  • 1
  • 2