Java_method - 메소드의 출력
https://www.youtube.com/watch?v=fhIDPeZ1sEM&t=2s
package method;
import java.io.FileWriter;
import java.io.IOException;
public class Whymethod_1 {
public static void main(String[] args) throws IOException {
System.out.println("--start--");
FileWriter fw = new FileWriter("out.txt"); // txt파일에 글씨출력하여 out.txt로 저장
fw.write(twoTimes("a", "*"));
fw.close();
System.out.println("--end--");
//Email.send("egoing@a.com", "two times a", twoTimes("a", "&"));
// 실행안됨 이런 예시도 있다는걸 보여주기위함
}
//매개변수, parameter
public static String twoTimes(String text, String delimeter) { //delimeter 구분자라는 뜻
String out = "";
out = out + delimeter + "\n";
out = out + text + "\n";
return out;
}
// return 값이 String이면 메소드에도 String으로 바꿔놔야하고 return값이 없으면 void로 해야함
// return 값이 있다면 실행되다가 return에서 멈춤
}