Java for Fucking Idiots: Learn the Basics of Java Programming Without any experience!



Download 3,91 Mb.
Pdf ko'rish
bet46/70
Sana02.04.2022
Hajmi3,91 Mb.
#524999
1   ...   42   43   44   45   46   47   48   49   ...   70
Bog'liq
Java for Fucking Idiots

class
Cat {
String
name
;
Cat(String name) {
this
.
name
= name;
}
void
meow() {
System.
out
.println(
"Meow!"
);
}
}
name
is a property.
meow()
is a method.
Why do Cats meow? In real life, who fucking knows. In Java, it’s when we
call the appropriate method on the Cat object.
Cat jasper =
new
Cat(
"Jasper"
);
jasper.meow();
What did we just do? Well first we instantiated a new Cat, which I covered
in the last chapter, you plumbus.
But after that we used a method called 
meow
. It printed out “Meow!” to the
screen.


We could call what we just did a a whole variety of things. Invoking the
method. Calling the method. Running the method. Executing the method.
“Doing the needful.”
By and large, I see and use the word calling . We called the meow()
method. When the meow() method was called, the cat meowed.
Lost in Translation
class
Translator {
String
languageFrom
;
String
languageTo
;
Translator(String languageFrom, String languageTo) {
this
.
languageFrom
= languageFrom;
this
.
languageTo
= languageTo;
}
void
translate(String textToTranslate) {}
}
Wew lad, a new class! This one is responsible for translating text between
two different languages. I’ll hide the code that would actually do the
translating. But it’s great, I assure you.
Let’s create a new translator. I’ll call him Eugene.
Translator eugene =

Download 3,91 Mb.

Do'stlaringiz bilan baham:
1   ...   42   43   44   45   46   47   48   49   ...   70




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