0

I'm using Visual Studio Code on my Mac laptop and I'm after writing my first program in Java but when I run the code I get an error message about System.out.

public class Hello
{
    public static void main(final String[] args)
    {
        System.out.println("Hello, World!");
    }
}

enter image description here

"Replace this use of System.out or System.err by a logger."

How can I fix this error?

Errigal
  • 15
  • 6

1 Answers1

2

This is a sonarlint error (visual studio code plugin), not a compiler one. This program will run perfectly fine, but apparently the plugin is configured to display this as error in IDE (you usually don't want System.out in production code).

According to https://www.sonarlint.org/vscode/, you should be able to adjust the rules in your IDE:

In the SonarLint Rules view in the explorer, you can activate and deactivate rules to match your conventions. There is also a code action on each issue to quickly deactivate the corresponding rule

Ondra K.
  • 2,767
  • 4
  • 23
  • 39