Step 2: Methods

In Java code is written in methods, so if you need to repeat code you can just call the method again. An example of this follows:

public void runner(){


public void integer(){
     int x = 3
     int b = 3 * x

     int y = x/b


Methods are useful because they allow you to make your code shorter and more efficient, methods are always started and finished with curly braces { }. When you add a new method you should always make sure that you have indented the ending curly brace at the same indent as the beginning of the method
Remove these adsRemove these ads by Signing Up