123jgh

导航

 

import java.io.IOException;

//Demo01类
public class Demo01 {

//main方法
public static void main(String[] args) {

}
/*
修饰符 返回值类型 方法名(...){
//方法体
return 返回值;
}
*/

//break:跳出swith,结束循环
//return:结束方法,返回一个结果
public String sayhello(){
return "hello,world";//返回字符串
}

public void print(){
return;//返回null
}

public int max(int a,int b){
return a>b ? a :b;//三元运算符
}

//数组下标越界:Arrayindexoutofbounds
public void readFile(String file) throws IOException{

}
}
posted on 2022-10-12 16:54  江江要努力  阅读(17)  评论(0)    收藏  举报