Head First Java a brain-Friendly Guide Kathy Sierra and Bert Bates



Download 17,18 Mb.
Pdf ko'rish
bet5/90
Sana22.06.2022
Hajmi17,18 Mb.
#693704
1   2   3   4   5   6   7   8   9   ...   90
Bog'liq
(Head Up) Kathy Sierra Bert Bates - Head First Java, 3rd Edition Early Release-O\'Reilly Media, Inc. (2021)

What goes in a method?


Within the curly braces of a method, write your instructions for how that
method should be performed. Method 
code
is basically a set of statements,
and for now you can think of a method kind of like a function or procedure.
Anatomy of a class
When the JVM starts running, it looks for the class you give it at the
command line. Then it starts looking for a specially-written method that
looks exactly like:
public static void main (String[] args) { 
// your code goes here 
}
Next, the JVM runs everything between the curly braces { } of your main
method. Every Java application has to have at least one 
class
, and at least
one 
main
method (not one main per 
class
; just one main per 
application
).


NOTE
Don’t worry about memorizing anything right now... this chapter is just to get you
started.
Writing a class with a main


In Java, everything goes in a 
class
. You’ll type your source code file (with a
.java extension), then compile it into a new class file (with a .class
extension). When you run your program, you’re really running a class.
Running a program means telling the Java Virtual Machine (JVM) to “Load
the 
MyFirstApp
class, then start executing its 
main()
method. Keep
running ‘til all the code in main is finished.”
In 
Chapter 2
, we go deeper into the whole 
class
thing, but for now, all you
need to think is, 
how do I write Java code so that it will run?
And it all
begins with 

Download 17,18 Mb.

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




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