일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- 프론트엔드
- 리스트
- 교보생명
- 웹개발
- jQuery
- 보험
- 인출수수료
- 특약
- 급성심근경색증
- 자바스크립트
- PythonProgramming
- 중도인출
- 프로그래밍
- 코딩
- 문자열
- 가입
- javascript
- Vue.js
- 수수료
- 변환
- python
- 심장질환
- 파이썬
- 납입
- Java
- 교보
- 보험료
- 추가납입
- 사망
- 뇌출혈
- Today
- Total
목록File 클래스 (3)
SeouliteLab
예제 1: File 클래스의 length() 메서드 사용 import java.io.File; public class FileSizeExample { public static void main(String[] args) { String filePath = "data/sample.txt"; File file = new File(filePath); long fileSize = file.length(); System.out.println("파일 크기: " + fileSize + " bytes"); } } File 클래스의 length() 메서드를 사용하여 파일의 크기를 바이트 단위로 가져옵니다. 예제 2: Apache Commons IO 라이브러리 사용 import org.apache.commons.io.Fi..
예제 1: File 객체의 delete() 메서드 사용 import java.io.File; public class FileDeleteExample { public static void main(String[] args) { String filePath = "data/sample.txt"; try { File file = new File(filePath); if (file.delete()) { System.out.println("파일 삭제 성공: " + filePath); } else { System.out.println("파일 삭제 실패: " + filePath); } } catch (Exception e) { e.printStackTrace(); } } } File 클래스의 delete() 메서드를 ..
Java에서 디렉토리(폴더)를 생성하는 다양한 방법을 알아보겠습니다. 각 방법은 예제와 함께 자세히 설명됩니다. 예제 1: File 객체의 mkdir() 메서드 사용 import java.io.File; public class DirectoryCreationExample { public static void main(String[] args) { String directoryPath = "C:\\example_directory"; File directory = new File(directoryPath); if (!directory.exists()) { directory.mkdir(); System.out.println("디렉토리 생성됨: " + directoryPath); } else { System.o..