Capitolul 2 - Sistemul de fisiere Flashcards

1
Q

Care este simbolul despartitor pentru path in windows si linux?

A

Pentru windows - \
Pentru linux - /

“Windows is backwards”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ce inseamna

.\

A

folderul curent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ce va afisa secventa de mais jos?

File f1 = new File("./file1.txt");
System.out.println(f1.createNewFile());
A

Va afisa true daca reuseste sa creeze acel fisier si false daca apare vreo eroare.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Care este diferenta din mkdir() si mkdirs() ?

A

mkdir creaza DOAR ultimul folder din path si va returna false daca restul folderelor nu exista.

mkdirs creaza tot path-ul.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
Cum pot sa sterg f1?
File f1 = new File("./file1.txt");
A

f1.delete();

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Cu ce a fost inlocuit pachetul java.io

A

Pachetul este java.nio.file si cuprinde urmatoarele clase de interes:

Interfata Path
Clasa utilitara Paths
Clasa utilitara Files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
ce se afiseaza?
Path p1 = Paths.get("C:/X/Y");
Path p2 = Paths.get("C:/A/B");
p1 = p1.resolve(p2);
System.out.println(p1);
A

C:\A\B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
ce se afiseaza?
Path p1 = Paths.get("X/Y");
Path p2 = Paths.get("A/B");
p1 = p1.resolve(p2);
System.out.println(p1);
A

X\Y\A\B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Cum se face rename la un fisier folosind nio2?

A

Files.move(sourcepath,destinationpath);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In ce pachet se gaseste clasa File?

A

java.io

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

in ce pachet se gaseste interfata Path ?

A

java.nio.file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ce face metoda relativize ?

Path p3 = p1.relativize(p2);

A

Returneaza calea pe care trebuie sa mergem pentru a ajunge de la p1 la p2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

ce face metoda normalize?

Path p2 = p1.normalize();

A

Normalize elimina elementele redundante dintr-o cale si o aduce la cea mai simpla forma a ei

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

createNewFile apartine de java.io sau java.nio?

A

java.io

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

size apartine de java.io sau java.nio?

A

java.nio

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

createFile apartine de java.io sau java.nio?

A

java.nio

17
Q

mkdirs apartine de java.io sau java.nio?

A

java.io

18
Q

delete apartine de java.io sau java.nio?

A

ambele