본문 바로가기 메뉴 바로가기

MLog

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

MLog

검색하기 폼
  • All (99)
    • Linux (17)
      • Tomcat (1)
      • Ubuntu (7)
    • Java (13)
      • Swing (7)
      • Android (3)
      • Eclipse (5)
      • Spring (3)
      • POI (12)
    • Web (5)
      • Java Script (2)
      • CSS (0)
      • PHP (0)
      • HTML (2)
      • JSP (1)
    • Database (13)
      • MySQL (13)
    • Others (9)
    • Sales (0)
    • AVR (1)
    • Windows (7)
      • VBA 매크로 (2)
      • Excel (4)
    • 짤 (0)
    • 기기 (3)
  • 방명록

textfile (1)
[Java] Text파일 라인 수 산출하기.

public class CountLineOfTextFile { public static void main(String[] args) { int lineCnt = 0; JFileChooser fc = new JFileChooser(); fc.showOpenDialog(null); File file = fc.getSelectedFile(); try { BufferedReader in = new BufferedReader(new FileReader(file)); while(in.readLine() != null) lineCnt++; } catch(Exception ex) {ex.printStackTrace();} System.out.println(lineCnt); } }

Java 2011. 7. 15. 14:22
이전 1 다음
이전 다음

Blog is powered by Tistory / Designed by Tistory

티스토리툴바