There are some syntax related issues in the code.
the keyword piblic should be public
sout should be System.out.println()
if Size is an interface it should be declared as:
interface Size{ }
Method1 is called as generic method in which you are using generic Type I, which extends the Size interface. this method can operate on any type that implements size interface while maintaing the exact argument types.
Method2 using the interface as a parameter simply takes objects of type size. this means the method can accept any class that implements size but it treats the parameter as just type size. you loose the ability to interact with type specific methods or behaviors of the actual class like (Triangle/Rectangle) since the reference is of type Size
So, both methods work similarly but method1 provides more type-specific advantages.