Yearly Archives

Overriding equals method in Java

Consider the following Java program: class Complex { private double re, im; public Complex(double re, double im) { this.re...

Overriding equals method in Java

Consider the following Java program: class Complex { private double re, im; public Complex(double re, double im) { this.re...

Flexible nature of java.lang.Object

We all love the mechanism of python, where we don’t have to bother about data types of the variables...

Flexible nature of java.lang.Object

We all love the mechanism of python, where we don’t have to bother about data types of the variables...

Static class in Java

Can a class be static in Java? The answer is Yes, some classes can be made static in Java....

Static class in Java

Can a class be static in Java? The answer is Yes, some classes can be made static in Java....

Object class in Java

Object class is present in java.lang package. Every class in Java is directly or indirectly derived from the Object...

Object class in Java

Object class is present in java.lang package. Every class in Java is directly or indirectly derived from the Object...

Covariant return types in Java

Before JDK 5.0, it was not possible to override a method by changing the return type. When we override...

Covariant return types in Java

Before JDK 5.0, it was not possible to override a method by changing the return type. When we override...

Assigning values to static final variables in Java

Assigning values to static final variables in Java: In Java, non-static final variables can be assigned a value either...

Assigning values to static final variables in Java

Assigning values to static final variables in Java: In Java, non-static final variables can be assigned a value either...

Static methods vs Instance methods in Java

Instance method are methods which require an object of its class to be created before it can be called....

Static methods vs Instance methods in Java

Instance method are methods which require an object of its class to be created before it can be called....

Shadowing of static functions in Java

In Java, if the name of a derived class static function is the same as a base class static...

Shadowing of static functions in Java

In Java, if the name of a derived class static function is the same as a base class static...

Can we Overload or Override static methods in java ?

Let us first define Overloading and Overriding. Overriding: Overriding is a feature of OOP languages like Java that is...

Can we Overload or Override static methods in java ?

Let us first define Overloading and Overriding. Overriding: Overriding is a feature of OOP languages like Java that is...