Skip to content

Instantly share code, notes, and snippets.

@danlangford
Created February 14, 2013 05:41
Show Gist options
  • Save danlangford/4950820 to your computer and use it in GitHub Desktop.
Save danlangford/4950820 to your computer and use it in GitHub Desktop.
just some ideas around variables and functions
package javaapplication1;
public class JavaApplication1 {
public static void main(String[] args) {
Integer sodasToday = 3,
sodasYesterday = 5,
totalSodas = sodasToday + sodasYesterday;
System.out.println("i drank "+ totalSodas +" sodas"); // this puts it on the screen
Integer cal = countCalories(totalSodas);
System.out.println("i had "+cal+" calories"); // this puts it on the screen
}
static Integer countCalories(Integer sodas) {
return sodas * 150;
}
} // end class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment