1, enter
Scanner Sc=new scanner (systom.in);
Sc.next (); Accept String Type data
Sc.nextint ();//Accept int type data
2, variable
In essence, a piece of storage space in memory (used to store data)
Naming rules:
You can only use numbers, letters, underscores, and $ components. Cannot start with a number, cannot use a reserved word
To the hump-type naming rules: To distinguish between words, the initial letter is smaller, followed by the first letter of the word capital
such as: Stumanagesystem
3, constant
Final
4, data type
Integer: Byte byte short integer int shaping long long shaped shape
Float type: float, double
Character type: Char
Boolean Type: Boolean
Note: In cases where high accuracy is required, do not use float,double, use Java.util.BigDecimal
Reference data types: string, array, interface, enumeration, class
5, array
int[] aa=new int[length];
6, Construction method
With and without parameters: used to initialize
7, access modifier
Public (can be used throughout the project)
Protected protected (can be used in the same package, can also be used with inheritance)
Private (can only be used in the current class)
Default (Friendly) defaults (in the same package)
8, rewrite
Return values, parameter names, method names are the same, content in the method body can be different
9, overload
Different parameters of the same life
10, interface
Can not be instantiated, only through his implementation class to operate, implement
11, abstract class (Abstrart)
cannot be instantiated and can only be manipulated by inheritance
12, Time
Date De=new date ();
Simpiedateformat sd=new Simpiedateormat ("Yyyy/mm/dd hh:mm:ss E");
Sd.format (DE)
13, random number
Random rd=new random ();
Rd.nextint ();
Generates random numbers from 3 to 30: Rd.nextint (27) +3;
Ran.nextfloat ()
Ran.nextdouble ()
14, set
The container used to store the data
The difference between a set and an array: the length must be certain, the data type must be orderly, the set
Collection is the root interface of the collection
Common methods:
The number of elements in the size () collection
IsEmpty () Determines whether the collection is empty (True is an empty collection)
Contains (Object o) determines whether the specified element is included
Iterator () iterator (no enhanced for loop is included in the loop before jdk1.5, only iterators are used)
ToArray () converts a collection into an array
Add (Object o) adds a collection element
Remove (Object o) removes the collection element
Clear () Removes all elements from the collection
Sub-interface; List ordered data is not unique. Set unordered, data unique map key value pairs stored in the form of data
The implementation class for list:
Arra ' ylist find data quickly, add, modify, delete slower
Find data quickly, add, modify, delete slower
List is ordered, data is not unique
Set unordered data unique
Basic Java Knowledge