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
<em>So if you have wandered onto this instructable, you are probably looking to learn how to program in java, or you just want to learn how to better understand how your computer/smartphone/tablet works.</em><br> <br> No, I wondered if there was anything much to learn in here, or if it would just talk a bit about a few things before ending with <em>make sure to vote for me in the () contest</em>(s)...<br> <br> L

About This Instructable




More by wamj:Intro to Java Programming 
Add instructable to: