OK, let's try again.
I created a class
Application
.
This is my application - surprising, I know.
Please also regard the break out of the static context.
There is an abstract class
MyAbstractClass
that has some method.
And there is a class
MyClass
that extends
MyAbstractClass
.
There is also a function
parseIntFromString(int)
, that is part of the abstract class. I'm changing it in
MyClass
, so it returns the result I want (That works as long as a function is not set "final").
With the help of this extension
MyClass
I can access all the functions of the abstract class
MyAbstractClass
, as you can see in the function
ignition()
package com.cp;
public class Application {
public Application(){
this.ignition();
}
private void ignition() {
MyClass oMyClass = new MyClass();
System.out.println("The result is " + oMyClass.tellIfPositive(3) );
System.out.println("The result is " + oMyClass.tellIfTrue(0));
System.out.println("The result is " + oMyClass.parseIntFromString("2"));
}
public static void main(String[] args) {
new Application();
}
public class MyClass extends MyAbstractClass{
public MyClass(){ }
public boolean tellIfPositive(int iValue){
if(0 <= iValue){ return true; }
return false;
}
@Override
public int parseIntFromString(String strValue){
return Integer.parseInt(strValue);
}
}
public abstract class MyAbstractClass {
public boolean tellIfTrue(int iValue){
if(1 == iValue){ return true; }
return false;
}
public int parseIntFromString(String strValue){
return 0;
}
}
}