Does Java support default parameter values?

后端 未结 25 1626
清歌不尽
清歌不尽 2020-11-22 07:07

I came across some Java code that had the following structure:

public MyParameterizedFunction(String param1, int param2)
{
    this(param1, param2, false);
}         


        
25条回答
  •  心在旅途
    2020-11-22 07:28

    You can do this is in Scala, which runs on the JVM and is compatible with Java programs. http://www.scala-lang.org/

    i.e.

    class Foo(var prime: Boolean = false, val rib: String)  {}
    

提交回复
热议问题