首页 > 解决方案 > getter 和 setter 方法是什么?

问题描述

我想知道getter方法和setter方法以及各自占用的功能

标签: methodsgettersetter

解决方案


Reading Javatpoint,

Getter and setter methods are frequently used in Java programming. Getter and setter methods in Java are widely used to access and manipulate the values of class fields. Usually, class fields are decorated with a private access specifier. Thus, to access them, public access specifiers are used with the getter and setter methods. https://www.javatpoint.com/getter-and-setter-method-in-java-example


推荐阅读