Java code as in course not working (closed)

in 5- primitive vs reference types, in Ultimate Java Part 1: Fundamentals
(types) the code bellow is correct and works, while for me it shows up as incorrect
x and y are collard red and the ; after is not in orange.
is there anything that im doing wrong? as this is the exact same code shown in the lecture. thanks

package com.codewithalex;

import java.awt.*;

public class Main {

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



Hello Alex,

Welcome to the Code with Mosh Forum. The issue is that you wrote “x:” and “y:” when that is something that IntelliJ adds. So, try the following code instead, and note that IntelliJ will add the “x:” and “y:” in order to clue the coder into what kind of parameters are expected.

Point point1 = new Point(1, 1);
1 Like

Thank you! I am learning the same class and had the same error for entering x: and y:. It works now.

1 Like