posted 20 years ago
While a constructor must have the same name as the class, it also CANNOT have a return type. as soon as you put that 'int' into the line ' public int sample()', you no longer had a constructor, but a method.
as others have pointed out, it's a bad choice for a method name, but it is a legal one.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors