Learn Java Coding

Everything You Have To Know About Java

Methods

At this point we only discussed the structure OUT-side of the Class, as shown on, “what is Java”.

However, for a regular schoolproject it is also necessary to have a structure in your text (think of: Introduction, Body, Conclusion). This page will discuss the structure that you use IN-side the class.methods javaAs you call the text blocks in your essays a paragraph, you call the text blocks in Java: methods. Paragraphs and methods have the same purpose. A paragraph and method both breaks the text into sub-topics.

Example

 JAVA ESSAY
 I made a game, in which you’ve to raise a dog  I wrote a book, in which I describe how my dog behaves
In this game the user can click:

  • feed
  • pet
  • walk the dog

I write these different points in different methods

 In my book I described:

  • how I feed my dog
  • how I pet my dog
  • how I walk the dog

I write these different points in different paragraphs

THEORY

Try while coding, to work as much in sub-topics as possible. As a programmer would say, work at much in methods as possible. Writing everything in ONE method can result in unreadable code.

bad code java

Therefore, DON’T

At the top of previous page I made it look like, a method is a block. That is for you visualisation. If you zoom-in. It has an structure.

There are 2 different types of methods?

CLICK HERE FOR THE STRUCTURE

Next Post

Previous Post

© 2024 Learn Java Coding