Professional Documents
Culture Documents
Lecture 11
Lecture 11
Lecture 11
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 1 Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 2
rights reserved. 0132130807 rights reserved. 0132130807
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 9 Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 10
rights reserved. 0132130807 rights reserved. 0132130807
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 13 Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 14
rights reserved. 0132130807 rights reserved. 0132130807
default - -
Visibility increases
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 15 Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 16
rights reserved. 0132130807 rights reserved. 0132130807
Visibility Modifiers A Subclass Cannot Weaken the Accessibility
}
can invoke m(); can invoke m(); cannot invoke o.m(); in the superclass, it must be defined as public
} }
in the subclass.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 17 Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 18
rights reserved. 0132130807 rights reserved. 0132130807
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 19 Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All 20
rights reserved. 0132130807 rights reserved. 0132130807