The difference between attributes and fields in Java, many people are inseparable. Especially the mybatis,spring configuration above the reflection technology, JSTL label

Source: Internet
Author: User

The properties in Java are generally understood to be derived from the get and set method names when their names are generic.

A field, usually called an "object member."

The rule is to remove the remaining string after get or set, and if the second letter is lowercase, turn the first letter into lowercase

Getage---->age

GETCPU---->CPU


property is limited to the declaration of a method in a class and is not related to other members of the class, but belongs to the JavaBean category. For example:
void SetA (string s) {}
String Geta () {}
When you have such a pair of methods in a class, we can say that the class has a read-write a property (note that it is lowercase a). If you remove the set method, it is a readable property and vice versa.
For example, the following class:
public class Person {
 private int x;
 public int Getage () {
  return x;
 }
 public void setage (int age) {
  this.x=age;
 }
}

When I manipulate this class, such as calling the Getage () method, we say that we get the age property, and we call the Setage method to say that we have set the Age property, because the X field is private to us, and we don't see the X field when we manipulate the person class.

For the MyBatis mapping configuration file, the

<resultmap type= "Author" id= "Baseresultmap" ><id property= "id" column= "id"/><result property= " Username "column=" username "/><result property=" password "column=" password "/><result property=" Email " column= "Email"/><result property= "bio" column= "bio"/><result property= "favouritesection" column= " Favourite_section "/></resultmap>

These
Property refers to an attribute, not a field.
There are JSP tag libraries in the use of JSP pages, also refers to attributes, not fields.

The difference between attributes and fields in Java, many people are inseparable. Especially the mybatis,spring configuration above the reflection technology, JSTL label

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.