And to expand on Henry's explanation, java.util.Set is an interface, meaning that it defines a contract that a class that implements the interface must honor. HashSet is merely one class that implements the Set interface. TreeSets, EnumSets and LinkedHashSets are just a few of the other classes that implement Set (and, of course, you can design your own Set implementation classes).
The advantage of defining s as a "Set" instead of as a "HashSet" is that you're defining the behavior of s in terms of its contract instead of in terms of its implementation. You can assign a HashSet object to a Set variable with impunity, but assigning some other Set object (such as TreeSet) would fail to compile or throw a ClassCastException (depending on how dynamic the code was).
If you program in terms of contracts instead of implementations, you have more flexibility. You can come back and swap out (or subclass) the object types to provide better functionality or performance and not have to do as much downstream code modification.
Science is the process of replacing what we "know" with what is TRUE. Politics, alas, often prefers to be the opposite.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop