new data type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    new data type

    If i want to have a class IntegerResult that holds Integer. How i do that?

    i want
    Code:
    public class IntegerResult implements IIntegerResult{
    Integer i =null;
    public IntegerResult getValue() [B]here i want it to return Integer[/B]
    public IntegerResult(Integer i){ 
        this.i=i;
    }
    }
    a class IntegerResult that holds integer and returns that integer
  • oll3i
    Contributor
    • Mar 2007
    • 679

    #2
    i'm almost there

    Code:
    public class IntegerResult implements IIntegerResult{
    Integer i =null;
    @Override
    public  <IntegerResult> Integer getValue(){ return i;} 
    
    public IntegerResult(Integer i){ 
        this.i=i;
    }
    }
    but it says that i did not override the method from interface
    Code:
    public interface ISimpleResult<T> extends ISingleResult{
        ISimpleResult<T> getValue();
    }

    Comment

    • Nepomuk
      Recognized Expert Specialist
      • Aug 2007
      • 3111

      #3
      Your getValue() function does not override the one in the Interface; you're returning an Integer, not an ISimpleResult<I nteger> as stated in the interface.

      Comment

      • oll3i
        Contributor
        • Mar 2007
        • 679

        #4
        Thank YOU i managed to do that

        Comment

        Working...