The type of the reference is what the compiler will check when it's asked to do something with the variable.
For example, if you have a method that is defined in s2 but not s1. Then you could call the method in your second case, but not your first case.
(If the method exists in both classes then it will, of course, use polymorphism to make sure the correct version is called according to the object type. But whether the call is allowed depends on the reference type.).