• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Defining a Class

 
Ryan Newcombe
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My professor wants my duck to quak. I have the basic idea down but I am having trouble getting my classes in order. The program should print "QUAK" when run. Please help.

public class Lab24B {
public static void main(String[] args) {
new Duck().sayHello();
}
}
private class Duck {
public String sayHello(String Quak) {
Quak = "QUAK";
return Quak;
}
}
 
Ryan Newcombe
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. Thanks anyways.
Ryan Newcombe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic