Let’s say I have a class that makes a ball. In the constructor, it accepts a String to indicate the kind of ball, but I only want it to accept certain values like: "FOOTBALL", "BASEBALL", or "SOCCERBALL", so that if I pass my class to another developer and they go to use it in Eclipse it prompts them as to the accepted value. How would I do that? I have no idea if there’s a general technique I could use or what it might be called, so pointers to a tutorial or example would be welcome.
public class Ball {
public Ball(String type){
…
}
}
Here’s a Ball class that defaults to FOOTBALL unless otherwise specified:
Edit:
I added doc comments for javadoc which I think is what you are looking for. Check this link out: How to Write Doc Comments for the Javadoc Tool