You can't do that in Java unfortunately. However you can make methods with the same return type as the class itself, and use return this;
after setting each field. Using return this;
makes method calls chainable with other method calls, and you can then use the method names as "labels" for your parameters. This is quite useful for minimizing redundancy in code, and the most popular variant for it in Java is the Builder Pattern which uses an additional Builder class as a complement to create easily customizable instances of a class. You'll see this type of thing in other languages as well, but most often for other purposes than fancy constructors (e.g. cascading Javascript libraries like JQuery).
For example:
class Car {
private int year;
private String make;
private String model;
private int mileage;
public Car year(int year) {
this.year = year;
return this;
}
public Car make(String make) {
this.make = make;
return this;
}
public Car model(String model) {
this.model = model;
return this;
}
public Car mileage(int mileage) {
this.mileage = mileage;
return this;
}
public void drive(int miles) {
this.mileage += miles;
}
}
public class DriveNewCar {
public static void main(String args[]) {
Car myDreamCar = new Car()
.year(2015)
.make("Tesla")
.model("Model S")
.mileage(0);
myDreamCar.drive(55);
}
}
Note that this is not the Builder Pattern, it's just using return this;
and short method names to make things a bit clearer on the API-client side, so it's basically just fancy setters.
Unlike Python, Java often likes to be verbose, even for the simplest things. This is why I highly recommend using a proper IDE like IntelliJ, Eclipse, or Netbeans to make your life easier.