Sunday 15 September 2013

java - Overriding Methods -


I need help with his problem I can not find anything on this subject (I'm probably looking for the wrong thing) < Define a sub-section called / p>

C which overrides the method m1 () , so that it returns the difference between the meter and the N.

  public class C {Private int m; Private int n Public C (int mIn, int nIn) {m = mIn; N = nIn; } Public Ent M1 () {Return M + N; }}    

First, m and N should be protected , not private ( protected is default). Then do something like this:

  Expansion of public square b C {public int m1 () {return m - n; }}    

No comments:

Post a Comment