I am new to Visual Studio Code and can’t figure this one out. Code (yeah, that’s all):
public class Main {
public static void main(String[] args){
System.out.println("Hello World");
}
}
Full error text:
public class Main{}
^^^^^
SyntaxError: Unexpected token 'class'
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1290:20)
at Module._compile (node:internal/modules/cjs/loader:1342:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
at Module.load (node:internal/modules/cjs/loader:1212:32)
at Module._load (node:internal/modules/cjs/loader:1028:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49
Node.js v21.6.1
(regular class Main{}
works for some reason, though…)
Already reinstalled VS Code, installed Node.js and JDK, tried restarting my PC etc. Other programming languages work as intended. Maybe I missed something? Saw a similar question on here but didn’t quite help… Also tried to replce “class” with “function”, didn’t work either.