2013年9月1日 星期日

java-parameter java-not-equal-null getParmeter not = null

java-parameter
getParmeter not = null

if (request.getParameter("keyValue") != null) {keyValue=request.getParameter("keyValue");}

Parameters allow a method to be generalized. That is, a parameterized method can operate on a variety of data and / or be used in a number of slightly different situations. To illustrate this point, consider the following very simple example. Here is a method that returns the square of the number 10:

int square(){return 10*10;}

While this method does, indeed, return the value of 10 squared , its use is very limited. However, if you modify the method so that is takes a parameter, as shown next, then can make square() much more useful.


int square(int i){return i*i;}


沒有留言:

張貼留言