In Java, Create a program named MethOps that demonstrates the impact of using
noncompliant code for the following situations. Show an example that
demonstrates incorrect behavior followed by a compliant example that shows
the correct behavior for each situation listed below.
• Be sure to use the same method type for the incorrect example as for
the correct example.
• Do not duplicate the examples from the book.
• Be sure to print appropriate supporting statements to make it clear what
you are demonstrating.
Situations to demonstrate:
1. OBJ00-J. Limiting extensibility of classes and methods with invariants to
trusted subclasses only.
2. MET03-J. Methods that perform a security check must be declared
private or final.
3. MET04-J. Do not increase the accessibility of overridden or hidden
methods.
4. MET05-J. Ensuring that constructors do not call overridable methods.
5. MET07-J. Not declaring a class method that hides a method declared in
a superclass or superinterface.
6. MET09-J. Classes that define an equals() method must also define a
hashCode() method.