Avatar ·

Does Java support default parameter values?

Hello everyone! I just started learning Java, before that I wrote a little in Python and JavaScript. There I was used to being able to set default values for function parameters, for example: ```python def greet(name="Guest"): print("Hello, " + name) ``` And call the function with or without an argument. In Java I tried to do something similar, but the compiler complains about the syntax. Here is my code: ```java public class Hello { public static void greet(String name = "Guest") { System.out.println("Hello, " + name); } public static void main(String[] args) { greet(); // I want to call without an argument greet("Anna"); } } ``` IntelliJ IDEA underlines = "Guest" in red and says "unexpected type". I googled it, but found a bunch of different opinions — some say