Forward Referencing

Today while I was studying for OCJP certification, I’ve learnt something new called Forward Referencing which yields to assigning a variable before defining it. So such below code will compile and work successfully public class ForwardReferencingExample { static { count = 2; } { count = 1; } public static int count; public static void main(String[]

Interfaces vs Abstract Classes

1. in interfaces you cannot define a body of a method, whereas it’s optional in abstract classes; public interface Animal{ public void eat(); public String getTypeOfAnimal(final String type); } public abstract class Animal{ abstract void eat(); String getTypeOfAnimal(final String type){ System.out.println("Given type of the animal is: " + type); } } 2.Defined variables in an

Complete and simple definitions of Up Casting, Down Casting, Implicit Casting and Explicit Casting

Nowadays I am preparing for the OCP, I’ve come to the topic of instanceof operator and casting in Java. I had obstacles in understanding the complete differences between Upcasting and Downcasting, so after a brief google search I’ve found very useful resources to apprehend the subject. Especially this post has given me such inspirational insights on the

Java ordinary object pointer OOP

I’ve come to find out this topic when I was watching a useful documentary about java fundamentals.  So the topic took my attention, and I’ve read some blogs regarding. It’s simply when you launch a 32 bit of jdk instance, defined variables will have such headers that will allocate some space in the memory, let’s assume