Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package Lab0501;
- import java.io.*;
- /**
- *
- * @author Nan Mihai
- */
- public class Prob1 {
- public static void main(String args[]) throws IOException {
- String nume;
- String cale;
- cale = "H:\\Anul II\\Programare orientata pe obiecte\\Java\\Lab1\\JavaApplication1\\src\\Lab0501";
- nume = cale + "\\" + "fisier.txt";
- try (LineNumberReader raf = new LineNumberReader(new FileReader(nume))) {
- String s[] = new String[100], text;
- int i = 0, j, n;
- while((text = raf.readLine()) != null) {
- s[i] = text;
- i++;
- }
- n = i;
- for(i = n-1; i >= 0; i--) {
- for(j = 0; j <= i; j++) {
- System.out.println(s[i]);
- }
- }
- raf.close();
- }
- catch(FileNotFoundException e) {
- System.out.println("Fisierul nu exista!");
- }
- }
- public void variantaRecursiva(String nume) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment