Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439

The second statement calls the move() method of the Point,but does not supply information about where to move the point.

Expressions in Parameter Lists

In this case, saying what method to run is not enough.The method needs information about what it is to do.When you look at the description of class Point the move() method is described as follows:

public void move(int x, int y);   // change (x,y) of a point object 

This description says that the method requires two parameters:

  1. The first parameter is type int. It will become the new value for x.
  2. The second parameter is type int. It will become the new value for y.

Dot notation is used to specify which object, and what method ofthat object to run.The parameter list of the method supplies the method with data.Here are some examples:

Point pointA = new Point();Point pointB = new Point( 94, 172 );pointA.move( 45, 82 );int col = 87;int row = 55;pointA.move( col, row );

You can put expressions into parameter lists as long as the expression evaluates to the type expected by the method. Of course, the expressions are evaluated (using the usual rules) before the method starts running.

pointB.move( 24-12, 30*3 + 5 );pointB.move( col-4, row*2 + 34 );

QUESTION 3:

What is the location of pointB after the following: