argument passing in java

原创 2006年06月06日 17:21:00

In generally, there are two ways that a computer language can pass an argument to a subroutine. The first way is call-by-value. This method copies the value of an argument into the formal parameter of the subroutine. Therefore, changes made to the parameter of the subroutine have no effect ont the argument. The second way an argument can be passed is call-by-reference. In this method, a reference to an argument (not the value of the argument) is passed to the parameter. Inside the subroutine, this reference is used to access the actual argument specified in the call. This means that changes made to the parameter will affect the argument used to call the subroutine. As you will see, Java uses both approaches, depending upon what is passed.

    In java, when you pass an object to a method, the situation changes dramatically, because objects are passed by reference. Keep in mind that when you create a variable of a class type, you are only creating a reference to an object. Thus, when you pass this reference to a method, the parameter that receives it will refer to the same object as that referred to by the argument. This effectively means that objects are passed to methods by use of call-by-reference. Changes to the object inside the method do affect the object used as an argument.

Remeber:
When a simple type is passed to a method, it is done by use of call-by-value. Objects are passed by use of call-by-reference.

obj-c编程10:Foundation库中类的使用(2)[字符串,数组]

Foundation库的内容不可谓不多,就算很精简的说篇幅也受不了啊
  • mydo
  • mydo
  • 2014年07月01日 18:40
  • 1783

gcc较高版本的一些编译警告收集

最近整理了下代码警告问题。这里记录一下。
  • subfate
  • subfate
  • 2015年05月06日 13:00
  • 2633

VxWorks/MIPS中断处理机制

http://blog.csdn.net/phunxm/article/details/8957955 在《中断处理》中,梳理了中断处理的一些通用框架和概念,下面我们来探讨一下VxWorks...
  • RubyBoss
  • RubyBoss
  • 2015年05月20日 21:34
  • 1304

Name for argument type [java.lang.String] not available, and parameter name information not found in

1、错误描述[ERROR:]2015-11-15 21:13:48,029 [异常拦截] exception.ExceptionHandler java.lang.IllegalArgumentExc...
  • you23hai45
  • you23hai45
  • 2015年11月15日 23:37
  • 13382

“passing argument 2 0f “request_irq” from incompatible pointer type”导致中断申请失败和模块无法加载

今天在些key的driver的时候。。。写完了编译出现一个warmming如下: warning: passing argument 2 of 'request_irq' from incompat...
  • lizhibin1091666592
  • lizhibin1091666592
  • 2011年09月27日 21:56
  • 1870

Passing Array From Javascript To PHP in Joomla!1.5

Debug in Javascript How to use 'Alert' : var variablename = 7; function show_alert() ...
  • zlxadhkust
  • zlxadhkust
  • 2011年10月23日 16:14
  • 650

Message Passing Leads to Better Scalability in Parallel Systems

Programmers are taught from the very outset of their study of computing that concurrency — and espec...
  • hellominix
  • hellominix
  • 2013年04月02日 10:31
  • 398

Passing Binary Data in COM在COM中传递二进制数据

  • 2006年02月23日 09:05
  • 2KB
  • 下载

opencv Error:Bad argument <Unknown arrray type> in cvarrTomat

2014年7月7日 这几天自己chan
  • Luckily118
  • Luckily118
  • 2014年07月07日 21:46
  • 2887

【GMT5】Ubuntu16.04下安装GMT5.2.1报错non-floating-point argument in call to function __builtin_isnan

按照SeisMan提供的教程进行安装:GMT 5.2.1 在 Linux 下的安装检查GMT 的依赖关系完毕后,开始编译和安装,使用make -j后出现如下问题: error: non-floatin...
  • shanchuan2012
  • shanchuan2012
  • 2016年10月31日 20:13
  • 827
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:argument passing in java
举报原因:
原因补充:

(最多只允许输入30个字)