GoConqr has a new look! Let us know what you think.

Mind map

methods and parameters of type object

daniela rodriguez Spanish

Map content

methods and parameters of type object

  1. Passing Information to a Method or a Constructor

    • The declaration for a method or a constructor declares the number and the type of the arguments for that method or constructor
  2. Parameters refers to the list of variables in a method declaration.

    • Arguments are the actual values that are passed in when the method is invoked.
      • You use varargs when you don't know how many of a particular type of argument will be passed to the method.
    • This includes primitive data types, such as doubles, floats, and integers, as you saw in the computePayment method, and reference data types, such as objects and arrays.
  3. When you declare a parameter to a method or a constructor, you provide a name for that parameter. This name is used within the method body to refer to the passed-in argument.

    • Many developers use the terms "type parameter" and "type argument" interchangeably, but these terms are not the same.
      • When coding, one provides type arguments in order to create a parameterized type.
  4. A parameter can have the same name as one of the class's fields

  5. public class Circle { private int x, y, radius; public void setOrigin(int x, int y) {

  6. public static void main(String[] args) { int x = 3; // invoke passMethod() with // x as argument passMethod(x); // print x to see if its // value has changed System.out.println("After invoking passMethod, x = " + x);

  7. By convention, type parameter names are single, uppercase letters.

    • Without this convention, it would be difficult to tell the difference between a type variable and an ordinary class or interface name.

Information

Description
Mind Map on methods and parameters of type object, created by daniela rodriguez on 17/05/2019.
Views
0
History
  • Created by daniela rodriguez · May 15, 2019
  • Copied by daniela rodriguez · May 17, 2019
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?