Keyword- and Default- Parameters in JAVA

By: Joseph (Yossi) Gil, Keren Lenza


Overloading is a highly controversial programming language mechanism by which different methods of the same class are allowed to bear the same name. Despite the criticism, Java programmers make extensive use of this mechanism---not just because it is available, but also because the language does not provide an alternative for defining multiple constructors, and because it is useful for expressing similarity of services provided by a class. In a previous paper we argued that more than 60% of the overloading cases are "justifiable" and that in 35% of the cases overloading is used for emulating a default arguments mechanism. Based on these results, this paper argues that most "justifiable" uses of overloading are better done with a combination of keyword parameters and default parameters parameter definition mechanisms, and describes our extension of the Java compiler which adds these two features to the language.


Java, overloading, compiler extension, default parameters, keyword parameters

Cite as:

Joseph (Yossi) Gil, Keren Lenza, “Keyword- and Default- Parameters in JAVA”, Journal of Object Technology, Volume 11, no. 1 (April 2012), pp. 1:1-17, doi:10.5381/jot.2012.11.1.a1.

PDF | DOI | BiBTeX | Tweet this | Post to CiteULike | Share on LinkedIn

The JOT Journal   |   ISSN 1660-1769   |   DOI 10.5381/jot   |   AITO   |   Open Access   |    Contact