Netbeans Java Error: "error: Diamond Operator is not supported in -source 1.5"

Asked

Viewed 226 times

2

I’m trying to use a List of Lists in Java in Netbeans for the first time:

List<List<String>> listao = new ArrayList<>();

But it presents a compilation error on the line where I have the list:

error: Diamond Operator is not supported in -source 1.5

And present the hint:

use -source 7 or Higher to enable Diamond Operator

Okay, but what source is this, and how to do this?

  • 1

    The tip is clear, Voce need to use a version of jdk 7 or higher to use diamond operator. Its version is 1.5 does not support.

  • 1

1 answer

4


First, right-click on your project to see the drop-down menu of the figure below, where you see the item "Properties" or "Properties":

Menu suspenso

When opening the properties, change the source code box to JDK 7 or larger:

Java 7

Browser other questions tagged

You are not signed in. Login or sign up in order to post.