add files

This commit is contained in:
2026-05-10 16:35:22 +03:30
parent f29dc564fb
commit 42f07c638d
14 changed files with 420 additions and 0 deletions
@@ -0,0 +1,27 @@
package org.FileExamples.ReadingFiles;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class ReadFileExample01 {
static void main() {
try
{
File file = new File("example.txt");
Scanner reader = new Scanner(file);
while(reader.hasNextLine())
{
String line = reader.nextLine();
System.out.println(line);
}
reader.close();
}
catch (FileNotFoundException e)
{
throw new RuntimeException(e);
}
}
}