首页 > 其他 > 详细

回顾方法定义

时间:2021-07-24 00:09:01      阅读:25      评论:0      收藏:0      [点我收藏+]

回顾方法定义

 

```java
package com.zishi.oop.demo01;

import java.io.IOException;

public class Demo01 {
public static void main(String[] args) {

}
/*
修饰符 返回值类型 方法名(。。。){
//方法体
return 返回值;
}
*/
//return 结果方法,返回一个结果!
public String sayHello(){
return "hello,world!";
}
public void print(){
return;
}
public int max(int a,int b){
return a>b ? a:b; //三元运算符
}


//数组下标越界: Arrayindexoutofbounds

public void readFile(String file) throws IOException{

}
}
```

 

回顾方法定义

原文:https://www.cnblogs.com/yizhifei/p/15054141.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!