Question
I have a program in java code below, it uses the @override syntax that 1.5 is compatible with however I need syntax that works with
I have a program in java code below, it uses the @override syntax that 1.5 is compatible with however I need syntax that works with jdk-11.0.2.
import blobz.*; import java.util.Random;
public class AsteroidField implements BlobGUI {
public static void main(String[] args) { new AsteroidField(); } private final SandBox sandBox; public AsteroidField() { sandBox = new SandBox(); sandBox.setSandBoxMode(SandBoxMode.FLOW); sandBox.setFrameRate(15); sandBox.init(this); }
@Override public void generate() { Random ran = new Random(); for(int i = 0; i < 20; i++) { int x = (ran.nextInt(3) + 1) * (ran.nextBoolean() ? -1: 1); int y = (ran.nextInt(3) + 1) * (ran.nextBoolean() ? -1: 1); double r = ran.nextBoolean() ? -.1: .1; sandBox.addBlob(new Asteroid(x,y,r)); } } }
the error is
Syntax error, annotations are only available if source level is 1.5 or greater
I can't change the compliance to 1.5 so I am trying to learn how I could use override while staying in jdk 11
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started