The first stage of learning JAVA summary

java foundation

Eight basic data types: byte short int long float double char boolean;

Reference Type: Array interface class basic data and reference types may all be received as a variable receipts

Variables can only receive a data

Constant: Once the amount can not be correctly modified is the constant.

Operators commonly used relational operators, logic operators, like arithmetic operators.

Array: As a variable can only store so we can use the time saved in an array of multiple data

array of tools sort method can be easily sorted to the array

String String is a special data type is a class (each also corresponds to a basic type class)

String bottom layer is an array of char

We can use the string class method to add the string. Remove Comparative Alternatively. Segmentation operation

Use StringBuffer class can save more resources in string concatenation.

*********************************************************************************************

Senior Java

Relationship with the object class: class is abstract object, the object is an instance of the class

Class contains the properties and methods.

We can use access modifiers: public private protection to determine access rights

Commonly used modifiers are pubilc and private 

Package: members of the class is private can use the package to be exposed to the outside packaging can make the property more secure.

Methods: a function of a method.

There are common methods, constructors, overloaded methods, override methods, abstract methods, static methods

Common method is a general method

Constructor methods named classes generally used to initialize the property

Overloaded methods, because the same method name and therefore programmers to call. Note overloaded methods must be different parameters

Abstract method, only present in the abstract modification abstract class, the method also requires use abstract modification

An abstract class can have both abstract methods may also have a physical method.

Overriding methods. The method of rewriting occurs it means that polymorphism occurs.

With reference to a different subclass object reference. Polymorphism is the

That is a subclass overrides a parent class, polymorphism occurs only in succession

Inherited need to use extends the parent class name after the name of the class to inherit the parent class

If the parent class is abstract. All you need is a method to the class

The right of inheritance, in addition to inheriting class can inherit interface. Interface

Of which only an abstract method, thus inherits the interface, you also need real

Now all of the interface methods. Distinction is an abstract class interface, pumping

Can have a physical method, only an abstract interface method as classes. Class

Inherit a class can only inherit in java, but can inherit multiple interfaces

So you can use the java interface multiple inheritance.

Static properties and methods do not return all the objects. Existed and when the class is loaded

And only one, can only use the class name method name or class name in memory. Attribute name

To call, (according to different development tools can also be called an object)

**************************************************************************************

Java exception mechanism of five keywords try ... catch to catch the exception

Or use this method throws an exception may occur in parentheses after the method declaration

Exception to the caller to deal with. That is the call of the try ... catch

finally keyword as long as there will be executed. Regardless of whether the program is running correctly

thorw can define their own throw, only three common, general use

try ... catch capture handle the exception, or throws an exception is thrown ..

In the memory array using an array of things when due to length restrictions, often can not meet

Demand. Thus, if a collection of commonly used list set and map collections

The method can be used with a set of many. Powerful and can be installed in any type of data

Because the collection can hold any type of data so the data set is unsafe.

So we used a generic collection. Will determine the type of data stored in the custom collection

This ensures data security.

Whether variables, arrays or collections, can only temporarily store variables, so we need to use

IO stream data stored in a file. This can be done permanently store data stored in the data

Because txt text cumbersome to operate and not intuitive

Therefore, we use XML to save the file, the benefits of XML documents is that he is not limited to any of

Platform, language and system, can easily exchange data and call data in different environments

But later we will use the database to store data.

Network Programming and multithreading

Socket network programming primarily for data exchange between computers

That is, data exchange and data between the client and the server share

Process is the system resources and space applications in the system independently owned

CPU scheduling thread is dispatched and the base unit, the order can be completed independently

Control flow, a thread to complete a project.

Run multiple threads in the same process is multi-threaded.

Multithreading is not really running multiple tasks at the same time but multiple threads

Alternately CPU resources. But because the process is very fast and therefore feel

Simultaneously. Multithreading can make full use of CPU resources, simplified programming model

Guess you like

Origin www.cnblogs.com/deemohans/p/11759217.html