All 1 entries tagged Fun

View all 59 entries tagged Fun on Warwick Blogs | View entries tagged Fun at Technorati | There are no images tagged Fun on this blog

July 28, 2007

Optional method parameters in java

Earlier this week someone was complaining java didn’t support optional method parameters. In some languages you can assign default values to parameters and if those parameters are not supplied then they will take on their default value. The syntax is usually something like SomeMethod(Param1=”foo”,Param2=2);

Whether this is actually any clearer than method overloading is debatable, personally I find it a little confusing. However, intrigued, I tried to see how close to this syntax it is possible to get in java. The following is as close as I could get, can anyone do better?:

Similar is possible in c# 3.0 with (should work with svn mono when compiled like: “gmcs -langversion:linq ./Filename.cs”)

September 2022

Mo Tu We Th Fr Sa Su
Aug |  Today  |
         1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30      

Search this blog



Most recent comments

  • Hey skx, how do you do that ? I run into the fu….. problem, that curl terminate with unspec. error… by David on this entry
  • With some minor changes this will also work for updating from 11.0 to 11.1. by skx on this entry
  • You are the man!!! Great work and good documentation! It worked without any problem for me. Thanks a… by Vany on this entry
  • didn't work for me. In fact killed the system. Have to download 11.0 and burn to dvd to fix it. by maybe windows on this entry
  • Will this method work for 11 => 11.1 ? by Erik Jakobsen on this entry

Blog archive

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder