Indlela yokubhala uhlelo lwe-Java

Umsebenzisi ngamunye okungenani kanye, kodwa wacabanga ngokudala uhlelo lwakhe oluyingqayizivele oluzokwenza kuphela lezo zenzo umsebenzisi ngokwakhe ozibuzayo. Lokho kungaba kuhle. Ukwakha noma yiluphi uhlelo oludinga ulwazi lwaluphi ulimi. Yimuphi Khetha kuphela wena, ngoba ukunambitheka nombala wazo zonke izimpawu zihlukile.

Sizobuka indlela yokubhala uhlelo lwe-Java. I-Java ingenye yezilimi ezithandwa kakhulu nezethembisayo. Ukuze sisebenze nolimi, sizosebenzisa imvelo ye-IntelliJ IDEA. Yiqiniso, ungakha izinhlelo kwi-Notepad evamile, kodwa ukusebenzisa i-IDE ekhethekile kusengcono kakhulu, ngoba isikhulumi ngokwazo sizokukhomba amaphutha futhi sisize uhlelo.

Landa i-IntelliJ IDEA

Qaphela!
Ngaphambi kokuqala, qiniseka ukuthi unenguqulo yakamuva yeJava.

Landa inguqulo yakamuva yeJava

Indlela yokufaka i-IntelliJ IDEA

1. Landela isixhumanisi ngenhla bese uqhafaza Ukulanda;

2. Uzodlulisela ekukhethweni kwe-version. Khetha inguqulo yamahhala yomphakathi bese ulinda ifayela ukuthi lilayishe;

3. Faka uhlelo.

Indlela yokusebenzisa i-IntelliJ IDEA

1. Hlela uhlelo bese udala iphrojekthi entsha;

2. Ewindini evula, qiniseka ukuthi ulimi lokuhlela yiJava bese uchofoza "Okulandelayo";

3. Chofoza "Okulandelayo" futhi. Ewindini elilandelayo, cacisa indawo yefayela kanye negama lephrojekthi. Chofoza "Qedela".

4. Iwindi lephrojekthi livuliwe. Manje udinga ukwengeza isigaba. Ukwenza lokhu, wandisa ifolda yeprojekthi bese uchofoza ngakwesokudla kwifolda ye-src, "Okusha" -> "I-Java Class".

5. Beka igama leklasi.

6. Futhi manje singaya ngqo kuhlelo. Ungakha kanjani uhlelo lwekhompyutha? Kulula kakhulu! Uvule ibhokisi lokuhlela umbhalo. Lapha sizobhala ikhodi yohlelo.

7. Yakha ngokuzenzakalelayo iklasi eliyinhloko. Kule klasi, faka indlela yomphakathi oyinhloko ye-static (String [] args) bese ufaka ama-curly curly {}. Uhlelo ngalunye kufanele luqukathe indlela eyodwa eyinhloko.

Qaphela!
Ngesikhathi ubhala uhlelo, udinga ukulandela ngokucophelela i-syntax. Lokhu kusho ukuthi yonke imiyalo kufanele ifakwe kahle, wonke amabhakede avulekile kumele avalwe, ngemuva komugqa ngamunye kufanele kube semicolon. Ungakhathazeki - ngoLwesithathu uzokusiza futhi uphume.

8. Njengoba sibhala uhlelo olulula, lusele ukufaka kuphela uhlelo lwe-System.out.print ("Sawubona, umhlaba!");

9. Manje chofoza ngakwesokudla egameni lesigaba bese ukhetha "Run".

10. Uma konke kwenziwa kahle, ukungena "Sawubona, umhlaba!" Kuzoboniswa ngezansi.

Siyakuhalalisela! Usanda kubhala uhlelo lwakho lokuqala lwe-Java.

Lezi yizona ezisisekelo zezinhlelo. Uma uzibophezele ekufundeni lolu limi, uzokwazi ukudala amaphrojekthi amaningi amakhulu nakwengeziwe kune-"World Hello" elula!
Futhi i-IntelliJ IDEA izokusiza ngalokhu.

Landa i-IntelliJ IDEA kusuka kusayithi elisemthethweni

Bheka futhi: Ezinye izinhlelo zokuhlela