Creating inner class example
This is an example of how to create an inner class. In short, to create an inner class we have performed the following steps: We have created a class CreatingInner that contains two inner classes,...
View ArticleInner class reference
With this example we are going to demonstrate how to make an inner class reference. In short, to make an inner class reference we have followed the above steps: We have created a class InnerClassRef,...
View ArticleAnonymous inner class constructor
This is an example of how to use an anonymous inner class. We have set an example following the above steps: We have created an abstract class, Abs that has a constructor and an abstract method. We...
View ArticleStatic inner class example
This is an example of how to use a static inner class. We have set the example as described below: We have created a class, ArAlgo that contains a static inner class P. Class P has two double...
View ArticleUse inner class for callbacks
With this example we are going to demonstrate how to use inner class for callbacks to a class. The example is described in short: We have created an interface, Incrementable and a class to implement...
View ArticleYou cannot override a method just by using the same name
In this example we shall show you why you cannot override a method just by using the same name. We are using two classes as described below: Class A has a method, char func(char a) that returns a char...
View ArticleYou cannot override a private or a private final method
This is an example explaining why you cannot override a private or a private final method. The example is described in short: We have created three classes, WithFinals, OverridingPrivate that extends...
View ArticleStatic fields inheritance
This is an example of static fields inheritance between two classes. The steps of the example are described below: We have created a class Aclass that has a static int val, and a static method fun()...
View ArticleYou cannot have static variables declared inside a method
In this example we shall show you the reason why you cannot have static variables declared inside a method. The steps of the example are described below: We have a class, StaticVar that consists of a...
View ArticleStatic clause initialization
This is an example of how to make a static clause initialization. In order to do so, we have created two classes as described below: We have a class A that has a method func(int val) that prints the...
View Article