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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!