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



Download 17,18 Mb.
Pdf ko'rish
bet6/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)

main()
.
The 
main()
method is where your program starts running.
No matter how big your program is (in other words, no matter how many
classes
your program uses), there’s got to be a 
main()
method to get the ball
rolling.


What can you say in the main method?
Once you’re inside main (or 
any
method), the fun begins. You can say all
the normal things that you say in most programming languages to 
make the
computer do something.
Your code can tell the JVM to:
 do something
Statements
: declarations, assignments, method calls, etc.


int x = 3; 
String name = “Dirk”; 
x = x * 17; 
System.out.print(“x is ” + x); 
double d = Math.random(); 
// this is a comment
do something again and again
Loops:
for
and 
while
while (x > 12) { 
x = x - 1; 

for (int x = 0; x < 10; x = x + 1) { 
System.out.print("x is now " + x); 
}
do something under this condition
Branching

if/else
tests
if (x == 10) { 
System.out.print("x must be 10"); 
} else { 
System.out.print("x isn’t 10"); 

if ((x < 3) & (name.equals("Dirk"))) { 
System.out.println("Gently"); 

System.out.print("this line runs no matter what");



SYNTAX FUN
Each statement must end in a semicolon.
x = x + 1
;
A single-line comment begins with two forward slashes.
x = 22; 

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