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


title = "How to Become a Fancy Waiter in Less Than 20 Minutes"



Download 3,91 Mb.
Pdf ko'rish
bet10/70
Sana02.04.2022
Hajmi3,91 Mb.
#524999
1   ...   6   7   8   9   10   11   12   13   ...   70
Bog'liq
Java for Fucking Idiots

title
=
"How to Become a Fancy Waiter in Less Than 20 Minutes"
;
bestBook.
content
=
"Forget everything that isn’t fine dining. And breathing."
bestBook.
averageRating
=
5.0
;
System.
out
.println(bestBook.
title
);
The result? The program spits out the text:
“How to become a fancy waiter in less than 20 minutes”
The dot, or period thing, is like a window into the object’s soul. Put the dot
after the name of your object, and access as much as you can see with it.
Methods
Remember the main method? Well, it’s called the “main” method because
it’s the big important one that runs first. But you can have more than one.
In fact, it’s highly recommended to have more than one method. Splitting
your code up into many smaller methods makes it easier to read and


understand what a program is doing.
We just briefly touched on properties, which are pieces of data that are
related to the object. The difference between properties and methods?
Properties are what an object is .
Methods are what an object does .
“But…but Steve. That doesn’t really explain what a method is in Java .
What are you, an idiot?” – you
Okay maybe not you. You probably wouldn’t remember my name.
Look, we’re early on in the book. There’s a lot of material to cover, and I
don’t want to get into the weeds (blaze it) of methods. I’ll give you one
example of what they look might like in Java.
class
Video {
void
resume() {…}
void
pause() {…}
int
getLikesCount() {…}
String getTitle() {…}
Video[] fetchRecommendations() {…}
boolean
isPaused() {…}
}
Just like with properties, you can use dot notation to touch its shit.
bestVideo.resume();
bestVideo.pause();
I just resumed and paused the video really quickly. Hopefully that didn’t
break it and cause it to buffer for an eternity…
Anyways, I realize I left those methods empty. Maybe those methods are
modifying properties (which I didn’t type out) of the Video object.
The great thing about objects and methods is that you’re dividing up the
code’s responsibilities into manageable chunks.
The 
pause()
method doesn’t need to know how to 
resume()
.


The 
fetchRecommendations()
method takes care of finding “related” videos
that YouTube wants to shove down your throat
getTitle()
don’t care about
that!
Good programmers keep their methods small, well-named, and
straightforward.
But that’s enough on methods for now – there’s a lot of very basic Java
concepts we need to cover before we dig much more into this. Onwards and
upwards!


CHAPTER 4: VARIABLES
 
"Not enough variables... hmm... not nearly enough variables." -
Heimerdinger
Okay, it’s time to dig into the nitty gritty of learning the language. Get your
big boy (or girl) pants on, cause shit is about to get real.
Let’s talk variables.
Ever take algebra in middle school? Seen something like this?
7 = 3 + x
Solve for x, right?
Variables are kind of like that.
Here’s an example

Download 3,91 Mb.

Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   ...   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