Property in Apex

What is property in Apex? Apex mainly consists of the syntax from the well-known programming language Java.As a practice of encapsulation in java we declare any variable as private and then create the setters and getters for that variable.

Private String name;
Public void setName(String n)
{
Name=n;
}
Public String getName()
{
Return name;
}

However, the Apex introduced the new concept of property from language C# as shown below:
publicString name {get; set;}
It has another advantage in “number of lines of code” limit by salesforce which will drastically reduced.