Skip to content

Instantly share code, notes, and snippets.

@scottfrazer
Created April 20, 2011 15:36
Show Gist options
  • Save scottfrazer/931673 to your computer and use it in GitHub Desktop.
Save scottfrazer/931673 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Derp
{
public Derp()
{
System.out.println("I get called when you do 'new Derp()'");
}
private int herp(int x, int y)
{
int q;
q = x+y;
return q;
}
public void foo()
{
int x, y;
System.out.println("Enter ");
Scanner k = new Scanner(System.in);
x = k.nextInt();
System.out.println("Enter y");
y = k.nextInt();
System.out.println("The sum of x and y is:" + this.herp(x,y));
}
public static void main(String[] args)
{
Derp derpObject = new Derp();
derpObject.foo();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment