Skip to content
Advertisement

Cannot use implements with Javas’ built in Integer [closed]

I am trying to run the code generated from an OpenAPI and as dumb as it sounds I am trying to create an interface to implement the Integer class. My code:

package io.swagger.client.model;
public interface TS29571CommonDataYamlcomponentsschemasDurationSec implements Integer(){
}

The error I get after running it:

/home/***/Desktop/java-client-generated/java-client-generated/src/main/java/io/swagger/client/model/TS29571CommonDataYamlcomponentsschemasDurationSec.java:[3,82] '{' expected

I am fairly new to Java so I believe I make an obvious mistake I am too untrained to find.

Advertisement

Answer

First of all: you don’t need paranethesis after the class name, i.e. it would be just implements Integer { which is why the compiler says { expected: it literally was waiting for a { when you put a ( there.

Second: Integer is not an interface, but a class. As such it can’t be implemented. It also can’t be extended (which would be next similar thing to attempt), because it is final.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement