Wat my logic says dat instanceof operator is always checked at compilation time and wat compiler will check is the reference tpe of s. If its of type AA or super class of AA (e.g. java.lang.Object), then compiler is HAPPY.
otherwise compiler will give error--->>> inconvertible types.
As per above, ur code will give compilation error inconvertible types in if condition.
The author is correct. s instanceof AA in your code means it is checked whether the object refered by s is an instance of AA class. And since you have not initialised s it will be set to null. so s instanceof String will check whether null is instance of string, which is obviously not.