1, Class encapsulation:
1. Concept:
Generalized encapsulation: the definition of functions and classes is the embodiment of encapsulation
Encapsulation in a narrow sense: some attributes of a class do not want to be directly accessed by the outside world in the process of use. Instead, this attribute is private [only held by the current class], ...
Posted by loveccb on Tue, 24 May 2022 14:40:03 +0300
1. Class Introduction
ES6 class can be regarded as just a syntactic sugar. Most of its functions can be achieved by ES5. The new class writing method just makes the writing method of object prototype clearer and more like the grammar of object-oriented programming.
The data type of a class is a function, and the class itself points to a constru ...
Posted by BIOSTALL on Mon, 23 May 2022 03:29:07 +0300
Java Day08
review
Characteristics of facing objects
Encapsulation, inheritance, abstraction, polymorphism
How to write a class?
Class: attributes and methods abstracted from the same thing
Object: instantiate a class to an object
Class contains:
Attribute member variable, construction method, general method, member method
bean object: attribute ...
Posted by johnska7 on Fri, 20 May 2022 13:44:27 +0300
Serialize and deserialize
All are to complete the operation of Java objects, write the Java objects to the file of the local hard disk, and restore the Java objects stored in the local file to the Java memory;
Serialization refers to outputting objects in memory to the hard disk for storage, while deserialization is the opposite operation, r ...
Posted by lill77 on Wed, 18 May 2022 09:59:22 +0300
I Date operation class
java.util.Date
If you want to obtain the current Date and time through this class, you only need to directly instantiate the Date class object: public Date().
package cn.mldn.demo;
import java.util.Date;
publicclass TestDemo {
publicstaticvoid main(String[] args) throws Exception {
Date date = new Date();
...
Posted by mazman on Sat, 07 May 2022 00:50:09 +0300
1, Constructor (Advanced)
When a class instantiates an object, the compiler will automatically call the constructor of the class and give an initial value to each member variable in the object.
1.1 initial value
class Time{
public:
Time(int hour,int minute,int second)
{
_hour = hour;
_minute = minute;
_second = second;
}
private ...
Posted by SieRobin on Sun, 01 May 2022 17:23:21 +0300
Java object oriented
Edited on: February 28, 2021
Read this section: it takes about 30 minutes, a total of 3099 words
1. Process oriented and object-oriented
Pop (procedure oriented programming) and OOP (object oriented programming) Object oriented is relative to process oriented. Process oriented, which emphasizes the functional behavior. ...
Posted by jaiswal on Thu, 14 Apr 2022 09:32:20 +0300
1. Succession
Inheritance is a mechanism for building new classes using existing classes. When creating a new class, on the one hand, it absorbs the members of the existing class, on the other hand, it can add new members and modify the services provided by the existing class.The inheritance mechanism facilitates the reuse and expansion of ...
1> Basis of reflection mechanism
1.1 function of reflection mechanism
adopt java The reflection mechanism in the language can manipulate bytecode files.
The advantages are similar to hackers. (bytecode files can be read and modified.)
Code fragments can be manipulated through reflection mechanism. ( class File.)
1.2 related classe ...
Posted by yellowepi on Sun, 10 Apr 2022 23:47:56 +0300
1. final
final means "last and final". Final can be used to modify classes, methods and variables (member variables or local variables).
1.1 decoration
when a class is modified with final, it indicates that the class cannot be inherited by other classes. String is a typical class of final type.
Note: all member ...
Posted by mduran on Thu, 31 Mar 2022 19:14:29 +0300