当前位置:网站首页>17day
17day
2022-07-19 05:23:00 【denggongming】
返回值归纳
我们在调用一个方法时,将方法体内产生的一条数据输出到方法体外使用,这条数据我们叫做返回值。
分类:
1.有参数有返回值
语法:
实例:
2.有参数无返回值
语法:
案例:
返回值
1.除构造方法外,其他方法声明时必须有返回值的占位符,当方法无返回值时,使用void;
2.返回值使用return关键字,一个方法中可以有多个return;
3.声明的返回值类型,要和真实的返回值类型保持一致;
4.当方法有返回值时,调用该方法,就会得到该方法返回的数据;
参数
1.参数是一个特殊的局部变量,在使用时无需在方法体内赋值;
2.参数的值是在调用该方法时,通过在括号中赋值时传递的;
3.方法中的参数可以有多个,即参数列表;
4.参数可以是基本数据类型,也可以是引用数据类型;
边栏推荐
猜你喜欢
Distributed unique ID
DOM 事件对象
Understanding of blocking assignment and non blocking assignment in FPGA
JVM之GC调优原理(六)
MySQL之InnoDB引擎(四)
XPath filters other tags in the tag to get all the content
Introduction to 3dslicer default extension module interface
Go zero business development Arsenal
Gocore-v2 framework - quick start
零碎知识点(一)
随机推荐
Verilog grammar basics HDL bits training 01
浅谈Break和continue语句的区别
Fragmentary knowledge points (I)
小白程序员第八天
Use tasks and random functions to write excitation test files during FPGA simulation
Swagger3的使用
Using OpenCV to connect cameras in 3dslicer
Modelsim报错“Instantiation of ‘****‘ failed. The design unit was not found.”
FPGA data receiving and sending and data loopback experiment based on serial port RS232
JVM之GC调优原理(六)
Model in pytorch train(),model. Eval () and torch no_ The difference between grad()
函数中的形参实参和返回值
Design of a simple DDS signal generator based on FPGA
Qt 日志文件系统
小白程序员第六天
选择结构 if分支结构
GC tuning principle of JVM (9)
Pytoch: dataset summary
今天讲一下选择结构之 If分支语句
Main path coverage and base path coverage