Java for Humans {Methods & Dot Notation}

Lincoln W Daniel
ModernNerd Code
Published in
10 min readJan 9, 2016

--

View Table of Contents | Download Supporting Code | Subscribe to ModernNerd Youtube Channel for Coding Videos | By Lincoln W Daniel

From the Classes and Objects chapter, you’ve learned that methods are used in Java to provide functionality to our classes and their instances. In this chapter, we will dive deeper into methods to learn how we create them, how we access them, and why they are important to Java programming. There’s a good deal to learn and this will be one of the longer chapters of the book, so take it slowly and calmly.

Why Methods are Important & Useful

Remember that in Java, everything revolves around objects. Objects are to Java programs as nouns are to English sentences. If objects are so important, they’d be really boring if all we could do is store information in them. Fields of classes are awesome for holding information about instances of our classes, but they aren’t much fun on their own. They can’t do any cool tricks. All they do is sit there and take up space in our programs. Imagine bringing home a new dog and naming it, memorizing its color, age and height, but not being able to do anything with it. Your excitement about your new dog wouldn’t last too long if that was the case. You’d want it to be able to actually do cool tricks instead of simply standing there and taking up space in your living room. That’s why Java and other programming languages decided to include the notion of methods.

--

--

Lincoln W Daniel
ModernNerd Code

Chief Bull @ BullAcademy.org ® Elevating writers @ ManyStories.com. Author @JavaForHumans Ex: Editor in Chief MarkGrowth (acq.), Engineer @Medium @GoPuff