Get current working directory



Download 0,84 Mb.
bet1/21
Sana21.04.2022
Hajmi0,84 Mb.
#569000
  1   2   3   4   5   6   7   8   9   ...   21
Bog'liq
notes2


Get current working directory
The current working directory means the root folder of your current Java project, it can be retrieved by using the following system property function.
There are two ways to get current working directory.
String workingDir = System.getProperty("user.dir");
FileSystems.getDefault().getPath("").toAbsolutePath().toString()

Create directory


1. Create Directory – Java NIO
1.1 We can use Files.createDirectory to create a directory.

  • If the parent directories not exist, throws NoSuchFileException.

  • If the directory exists, throws FileAlreadyExistsException.

  • If IO errors, throws IOException.

1.2 We can use Files.createDirectories creates a directory including all nonexistent parent directories.



  • If the parent directories not exist, create it first.

  • If the directory exists, no exception thrown.

  • If IO errors, throws IOException

2. Create Directory – Legacy IO


For legacy IO java.io.File, the similar methods are file.mkdir() to create a directory, and file.mkdirs() to create a directory including all nonexistent parent directories.
Both file.mkdir() and file.mkdirs() returns a boolean, true if success to create the directory, fail otherwise, no exception thrown.



8. Learn Data Structures and Algorithms

What is a Stack?


A stack is an ordered list in which insertion and deletion are done at one end, called a top. The last element inserted is the first one to be deleted. Hence, it is called the Last in First out (LIFO) or First in Last out (FILO) list.
Stack – bu tartiblangan ro’yxat hisoblanadi.

Stack Operations

The following operations make a stack an Abstract Data Type.

Lets first familiar with few concepts that are used in stack implementation.

Stack Concepts


  1. Download 0,84 Mb.

    Do'stlaringiz bilan baham:
  1   2   3   4   5   6   7   8   9   ...   21




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish