JavaBean reprint! ! ! ! !

JavaBeans is a special class in Java, objects may be packaged into a plurality of objects (the bean) of. Characterized serializable provided constructor with no arguments, providing property getter and setter methods to access the object. The name "Bean" is the usual name for Java for reusable software components.
- more from Wikipedia
outset, we package an object when it comes to car object as an example:


CAR class {public
/ **
* This is a five car
* /

Private int. 4 wheels =;
Private int steering wheel. 1 =;
Private seat int. 5 =;


public int GET wheel () {
return wheel;
}
public void SET wheel (int wheel) {
. the this wheel = wheel;
}
public int GET steering wheel () {
return steering;
}
public void SET wheel (int wheel) {
the this steering = wheel;.
}
public int GET seat () {
return seat;
}
public void set seat (int seat) {
. = the this seat a seat;
}

}
start learning java, we put the above code is called an object class, and at a later stage, we call a javaBean. For ease of operation since the late java data, usually using an object as a container, the data needs to be assigned to the operation of the object, and in order to facilitate the assignment, then we must have this get / set methods.

Summarized as follows:

1, all the attributes of Private
2, provides a default constructor
3, a getter and the setter
. 4, the interface to achieve serializable

The above content written in November 2018 20:07:41 8th, the current understanding is that the container data If then have feelings, will continue to update this post. Dear friends, if there is a better understanding of the welcome message to share, thanks.
----------------
Disclaimer: This article is CSDN blogger original article, "Sam Rainsy _", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source and this link statement.
Original link: https: //blog.csdn.net/zhouvip666/article/details/83867401

Guess you like

Origin www.cnblogs.com/guozy123/p/11882318.html
Recommended