What's the use case of a protected method in a final class in Java?

前端 未结 5 1497
眼角桃花
眼角桃花 2021-01-18 02:48

Consider this code from the official OpenJDK source of java.awt.font.TextLayout:

public final class TextLayout {

    /* ... */

    protected v         


        
5条回答
  •  梦毁少年i
    2021-01-18 03:16

    Just so it's out there: if this was a class that extended another, the protected method might be extending a protected method in the superclass. Another possible reason to look for.

提交回复
热议问题