Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Test[] t1 = new Test[3];
- try (Scanner sc = new Scanner(new FileInputStream("C:\\azaza\\src\\Lesson_12_2\\workers.txt"), "WINDOWS-1251");
- ) {
- for (int i = 0; i < t1.length; i++) {
- String line = sc.nextLine();
- String[] tokens = line.split("\\|");
- t1[i] = new Test(tokens[0], tokens[1]);
- }
- } catch (FileNotFoundException e) {
- }
- System.out.println(Arrays.toString(t1));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement