Methods - Anything private void printIntro...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1 An Example of a Method private double feetToInches(double feet) { return 12 * feet; } Multiple return statements private int max(int val1, int val2) { if (val1 > val2) { return (val1); } else { return (val2); } } Predicate Methods private boolean isOdd(int x) { return ((x % 2) == 1); } Methods that Don’t Return
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Anything private void printIntro() { println("Welcome to CS106A"); } Returning objects private GOval filledCircle(double x, double y, double r, Color color) { GOval circle = new GOval(x-r, y-r, 2*r, 2*r); circle.setFilled(true); circle.setColor(color); return circle; }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online