맛집탐방

파일에서 문장전체 출력 본문

Java

파일에서 문장전체 출력

cowbeaf 2020. 9. 14. 15:12
public void readAllLines() {
 Path path = Paths.get("C:\\Users\\Payment\\default.txt"); //파일경로
  Charset charset = Charset.forName("UTF-8");
	try { List<String> lines = Files.readAllLines(path, charset); 
		  for (String sentence : lines) {
			  System.out.println(sentence);				
			} 
		}catch (IOException e) {
			e.printStackTrace();
		} 		
}

 

'Java' 카테고리의 다른 글

Quick Sort  (0) 2020.09.11
Java  (0) 2020.09.11
Comments