Getting an Error

I was trying the following code on my IntelJ

package com.Global2020;

import java.awt.*;
import java.util.Date;

public class Main {

public static void main(String[] args) {

Point point1 = new Point(x: 1, y: 2);
Point point2 = point1;
point1.x = 3;
point1.y = 5;

I have got the following error;

java: β€˜)’ expected

It drives me crazy because, I can not see my mistake. If you please can help me that will be great.

Hi and welcome.

Please put code in code fences so it’s properly formatted.

In Java you don’t type the parameter names when calling constructors or methods. So instead of new Point(x: 1, y: 2); type new Point(1, 2);


Thank you for your help