Methods #1
1. Call this method so that it prints “I like apples”.
void food(String fruit) {
System.out.println("I like " + fruit);
}
2. Call this method to that it prints “Nerds rule”.
void truth(int x) {
if(x > 5)
System.out.println("Geeks rule");
else
System.out.println("Nerds rule");
}
3. Use this method to draw a square. Don’t change the inside of the method.
void drawLine() {
Tortoise.move(100);
Tortoise.turn(90);
}
4. Fix any problems with the following constructors.
class Hell {
void Hell(int hotness) {
}
}
public class Bacon {
String style = "streaky";
Bacon (String style) {
style = style;
}
}
public class Unicorn {
private Unicorn() {
this.horns = 1;
}
}
class Narwhal {
public Narwhale(){}
}