Subtyping refers to compatibility of interfaces. A type B is a subtype of A if every function that can be invoked on an object of type A can also be invoked on an object of type B.
Inheritance refers to reuse of implementations. A type B inherits from another type A if some functions for B are written in terms of functions of A.
Example
Integer is a subtype of Number
ArrayList<E> is a subtype of Collection<E>
String is a subtype of Object
JPanel panel = new JPanel(); panel.add(new JTextField(20)); panel.add(new JButton(“OK”));