Package, rewriting, overload
l The high efficiency of the code is not the advantage of the package.
l The class and interface to implement an interface is the relationship between IS A.
When the L subcarpse rewrites the parent class method, the type of method returns must be the same, otherwise the compilation is not passed.
l If the subclass implements a polymorphism, if only the return value of the method is different, it will be compiled in the second and later methods.
l If the polymorphism is implemented, the parameters of the method are F (int, int) and f (line, int); then f (1, 2) will perform F (int, int).
If you call Super () or this () in the L subclass, you must appear at the same time.
Internal class
l Static Inner Classes:
Only the uppermost class can be available, and it can only access the static variable
l MEMBER Inner Classes:
To create an instance, there must be a reference to the upper layer, which does not contain the Static method.
l Local Inner Classes:
Only the local variable (not the upper layer) declared for Final can be accessed directly. The local and anonymous internal classes cannot be declared as private, public, protected or statics.
l Anonymous Inner Classes:
Anonymous classes cannot contain constructor.
Note: In the internal class, this refers to an instance of an internal class, to get an instance of Enclosing Class, to prefix it in front.
Thread
l Create, initialize, start new threads
Threads can be created by inheriting Thread and overwriting public void run ()
It can also be implemented by a construction method of Runnable object parameters.
The start () method can only call the runnableException, (ThreadStateException)
The Thread class implements Runnable
l Conversion of the state of the thread
Runnable-> Running-> dead
Wait () and SLEEP () make thread waiting
Waiting-> Runnable
Start Again after a thread DEAD
Object defines methods such as WAIT (), Notify (), NotifyAll ().
Notify () Is to Sigmal That It Should Proceed in Executing Instructions.
Interrupted () and interrupt () Are Instance Methods of Thread.
Sleep () and yield () area static methods of thread.
l Make thread Sleep
Sleep () allows the thread to stop performing a period of time, but the lock did not unlock.
Interrupt () can stop sleep () and waiting ()
Threads in an I / O blocking or waiting lock cannot be used by Interrupt ()
The Sleep () method must have TRY, CATCH, or by throws
l Communication via waiting and notifying
Note using Synchronized
l dead lock, yield ()
l Only the run () method is defined in Runnable Interface.
THE java.lang.math
Using the java.lang.math class
l The ABS () Method is overloaded to take, a long, a float, or a double.
l The abs () method can return a negative if the argument is the minimum int or long value equal to the value of Integer.MIN_VALUE or Long.MIN_VALUE, respectively.l The max () method is overloaded to take int, long, float Double arguments.
l The min () Method is overloaded to take int, long, float, double arguments.
l The random () Method Returns A Double Greater Than OR Equal to 0.0 And Less Than 1.0.
l random does not take it..
l The Methods CEIL (), Floor (), Round () All return INTEGER Equivalent Doubles.
l the runk () method is overloaded to take a float (The Other Method Takes A Double). Math.Round (9.5) = 10
L The method sin (), cos (), and tan () Take A Double Angle in Radians.
l the method sqrt () can return nan if the argument is
Nan
Or Less Than Zero. Static Double SQRT (Double)
Strings
Creating and Working with strings in java
L String Operations Are Carried Out by String Class, Which Can Be Found In The Java.lang Package.
l strings can be concatened with the folload syntax:
String s = new string (<>);
l " " and toString ()
Storage of strings and string Immutability
L in Java, Strings Are Immutable. Their Contents Can Never Be Changed.
L Text for strings defined At Compile Time and strings with identical contents may Share the Same Memory Space.
Constructors and methods for the string class
.
l The equals () method is used to compare two strings and determine whether they are identical. The == operator should not be used, as it will only determine whether the two string variables reference the same object.l The indexOf () and lastIndexOf .
USING THE STRINGBUFFER CLASS
l .ir contents can be changed.
L StringBuffers Are Initialized with a certin character. if this. Capacity is extended, The StringBuffer Object Automatically Grows.
Constructors and Methods for the stringbuffer class
l The setcharat (), INSERT (), delete (), and append () Methods Are used to work with individual characters and string of characters in stringbuffers.
L All Positional Arguments for Methods in The string or stringbuffer classes area Zero-based. The first charater is reference as zero.
The java.util package
The Collection Framework
l The Four Properties That Differentiate Collectes Are
Sorted, Ordered, Allows Duplicates, And Uses Keys.
L in stric Terminology, a set cannot beboth Ordered and sorted.
L An Ordered Set Keeps Track of The Sequence In Which Objects Are Added To It. It is unsorted, however.
L A Sorted Set Uses The Natural Order Orth Objects, Such as alphabetical.
Collection Interfaces and Classes
l a set can store Only Unique Objects, Not Duplicates.
l a list keeps the objects indexed in a definite Order.
L a map stores objects in assending to keys.
l sORTEDSET Stores Objects in Ascending Order WITHOUT DUPLICATES.
l The Null Object Can't Be Used To Sort Objects, So A Sorted Sets. LikeWise, a sortedMap Can't Contain Keys That Are Null.l Hashset Implements The Set Interface.
l LinkedList, Vector, And ArrayList Implement List.
l Hashmap and hashtable Implement The Map Interface.
l TreeMap Implements The SortedMap Interface.
The java.awt package
Components
.
.
Containers
A Container IS A TYPE IF Component That Contains Other Components.
.
Layout Managers
A Container Uses a Layout Manager To Position The Components That It Contains. It is specified using the contact.setLayout () Method.
THE LAYOUT Manager for a Container Determines The size and position of each component within a container.
If No Layout Manager IS Specified for a Container Then Absolute Positioning IS Used To Determine Each Component's Position.
Menus
.
A MenuBar Must Be Associated With a frame in Order to visit the frame.setmenubar () Method.
A menubar can have menu Objects added to it usding the add () Method.
.
Painting
.
To ask the gui to refresh a Component, The Repaint () Menthod Can Be Called. There is no guarance it will be refreshed Right Away.
. ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,