Invalid AssignmentOperator used in lecture?

Hi ,
first of all, the lectures are pretty good but there is something which does not work with Java when following the coding examples.

In the 5. Video of the Ulitmate Java 1 Fundamentls path, there is an error or I do not possess the new Java version?
In the lecture video about - Primitive vs Reference Types at 3:30 min I have not been able to reproduce your code line without getting a syntax error.
The object’s assignment, which looks alike in javascript, does not work in my case and throws syntax error:


import java.awt.*;

public class Main {
    public static void main(String[] args) {
      Point point1 = new Point(x:1,y:2);    
    }
}


Point(x:1,y:2) assignment throws a syntax error:

"Syntax error on token ":", Invalid AssignmentOperator"

I would like to know why this assignment operation does not work in my case ? I use VS Code and additional extensions but not the IDE like Mosh uses.
Thank you very much in advance,

Vanessa

Problem resovled:

There can be only one public class in the same source file, otherwise the class has to be defined in another source file and then can be intstansiated in the public main class.

This error actually comes up all the time. He is not literally typing the parameter name or the colon. The IDE adds these just to make it easier to read the code.

Hi,
thank you for the answer, but actually, the problem was that I didn’t import the right java package.
It worked,
thanks

I promise you, this syntax is invalid:

Point point1 = new Point(x:1,y:2);

It should be this:

Point point1 = new Point(1,2);

Thank you very much,

actually it worked after

import java.awt*

import. But I don’t think it is clean. I use vscode and the prettier extension always renders it to the : notation, like in javascript. I don’t think it is very clean,though.
Thanks and have a nice day