Arguments and Parameters

I am reading SCJP 6 from Sierra and Bates. The first chapter contains the section "Final Arguments" (p. 41). In this section, he refers to “method arguments” as “variable declarations that appear between parentheses in a method declaration”.

However, elsewhere (in the book and on the net), the agreement is that we “pass arguments” and “declare parameters”.

Am I reading this wrong?

+4
source share
1 answer

You are right - the book is mistaken in this particular place and in another place. Arguments appear on the call site, parameters are part of the method declaration.

The Java language specification supports these method invocation expressions - methods contain argument lists ( JLS 15.12 ); ( JLS 8.4.1 ), which includes the following:

When a method or constructor is called (§15.12), the values ​​of the actual argument expressions initialize the newly created parameter variables, each of the declared type, before executing the body of the method or constructor.

If this is some kind of consolation, these terms are used incorrectly throughout the network, even by those who know better, but very often carelessly ... and I include myself in this, although I try on this :( A good example of this is C #, where version 4 provides named arguments and optional parameters, but this function is described with just about every incorrect permutation that you might mention.

+4
source

Source: https://habr.com/ru/post/1435437/


All Articles