In Java programming, a member is decorated with the private keyword, and only the class in which the member is located and the method of the class are available, and no other class can access the private member.
The basic function of the private
The modifier private provides the highest protection and lowest visibility: The private decorated domain, method, and nested type, which can only be accessed in its definition class.6.3.1 PrivateThere will be some procedural restrictions in the
In Java programming, a member is decorated with the private keyword, and only the class in which the member is located and the method of the class are available, and no other class can access the private member.
The basic function of the private
Learn about encapsulation what is encapsulation?In Java's object-oriented programming, there are three basic features: encapsulation, inheritance, and polymorphism. First, let's take a look at the package:In Java's object-oriented programming,
[Java entry notes] three features of object-oriented: encapsulation and javaWhat is encapsulation?
Java object-oriented programming has three basic features: encapsulation, inheritance, and polymorphism. First, let's take a look at the encapsulation:
Asp.net modifier introduction (about public, private, protected, internal), protectedinternal
1. private Modifier
The private modifier is used to set the access permission of a class or class member to the internal of the class,Private is also
1. Private Modifier The private modifier is used to set the access permission of a class or class member to the internal of the class,Private is also called a private modifier. You can use the get and set accessors to read or modify private class
Object OrientedProgramming Essence: Organizing code in a class, organizing (encapsulating) data in an object way
Object
: A specific thing, an object (instance) class of a class: An abstraction of an object that describes an abstract
1 //The following code implements settings and obtains student names and scores. 2 classlesson5homework3 {4 Public Static voidMain (string[] args)5 {6Testcode tc=NewTestcode ();7Tc. Studenttest ();//calling the test class8 }9 }Ten
Package Hello2;public class Person {String name;int age;public void Book () {System.out.println ("reading");}public void TV () {System.out.println ("watch TV");}}
Encapsulation is used in order to limit the use of class attributes, such as the
1. Objects object: Represents an entity that can be clearly identified in the real world. For example: A student, a table, etc. Each object has its own unique identity, state, and behavior.
1) The state of an object refers to
Java Encapsulation
Encapsulation. The connection between an object and the outside world should be made public through a unified interface and hidden. (The attributes of an object should be hidden.) an object is transparent internally, that is, the
Private Static final long serialversionuid = ???
What is the purpose of this variable?
Generally, when is this variable added? What are the requirements for its value?
You can understand it as follows:Serialversionuid is used to indicate the
This section contains content:
Mix and Match overview (mix and Match overview)
Import in target of the same app (importing Code from within the same app target)
Import from Target in the same Framework (importing Code from within
[Java Basics] setter and getter methods, javasettergetter
1 // the following code sets and obtains the Student name and score. 2 class lesson5homework 3 {4 public static void main (String [] args) 5 {6 TestCode TC = new TestCode (); 7 TC.
1.private modifierThe private modifier is used to set the access rights of a class or class member only to the inside of the owning class.Private is also known as a private modifier. Sometimes when you need access to a private class member, you can
C # basic (5) -- Role of private constructor in the class,
If a class member has a private modifier, the class member cannot be accessed outside the class scope. When the class constructor applies the private modifier, the external class is
Java Study Notes 21 --- supplementary description of internal classes of members (2) (corrected), Study Notes 21 ---
Fixed: the original article was a bit incorrect, mainly concerning the subclass of the member's internal classes.
Due to my
A private constructor is a special instance constructor. It is typically used in classes that contain only static members. if a class has one or more private constructors and no public constructors, other classes (other than nested classes) cannot
[C # advanced series] 07 method,
Instance construction and reference type
The previous chapter has actually written the construction process of the reference type:
First of all, in the heap, allocate memory for instance objects of the reference type,
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.