package com;
public class Demo {
public static void main(String[] args) {
// 无参数无返回值的方法调用
test();
// 无参数有返回值的方法调用
String str1 = test1();
System.out.println(str1);
System.out.println("----------------");
// 有参数有返回值的方法调用
String str2 = test2("有参数有返回值的方法");
System.out.println(str2);
System.out.println("----------------");
// 有参数有返回值的方法调用
int max = getMax(20, 10);
System.out.println("最大值"+max);
// 有参数无返回值的方法调用
test3("这是");
};
public static void test() {
System.out.println("无参数无返回值的方法");
System.out.println("----------------");
};
public static String test1() {
String str= "无参数有返回值";
return str;
};
public static String test2(String f ) {
return f;
};
public static int getMax(int a, int b) {
if (a>b) {
return a;
} else {
return b;
}
};
public static void test3(String str3) {
System.out.println(str3+"有参数无返回值");
};
};



