Here are some of the lessons I summarized in the previous lesson and the code is most of the teacher's notes personally think is very good, but also a more classic content, sincere hope that these for those who want to learn some help!
Because the code is sub-module upload is very inconvenient. Also more, speak of is more clear! If you need to be able to leave your email in the comments I see will be sent to you for free! Thank you for this platform let us all progress together!! Remember that the programmer is selfless!!!
Also very welcome to my blog to watch the blog address: http://www.cnblogs.com/duscl/
/*2:API Overview (Understanding) (1) Application programming interface. (2) is the Java class that the JDK provides to us to improve programming efficiency. 3:object Class (Master) (1) object is the root class of a class hierarchy, and all classes inherit directly or indirectly from the object class. (2) The construction method of the object class has one, and it is an parameterless construct. That's what we said at the time. The construction of the subclass constructor method, which is the default access to the parent class, is a non-parametric construct (3) the method to master: a:tostring () returns the string representation of the object, The default is the hexadecimal representation of the full path + ' @ ' + hash value of the class. This representation is actually meaningless, and the generic subclass overrides the method. How do I rewrite it? The process I have also explained, basically is the request information simple and clear. But it will eventually be generated automatically. B:equals () compares whether two objects are the same. By default, the comparison is the same as the address value. Comparing address values is meaningless, so a generic subclass overrides the method. Rewrite process, I also explained and analyzed in detail. But it will eventually be generated automatically. (4) method to understand: A:hashcode () returns the hash value of the object. is not an actual address value, which can be understood as an address value. B:getclass () Returns the object's bytecode file object, which we will explain in detail c:finalize () for garbage Collection, D:clone () can implement the cloning of an object at an indeterminate time, including data replication of member variables, but it and two cited There is a difference between pointing to the same object. (5) two points of attention; A: Output an object name directly, but the ToString () method of the object is called by default. B: The difference between the question = = and equals ()? a:== base type: Compares whether the value is the same as the reference type: compares whether the address value is the same b:equals () can only compare reference types. By default, the comparison is the same as the address value. However, we can base our ownNeed to override this method. 1:scanner Use (Understanding) (1) The class that appears after JDK5 for keyboard entry data. (2) Construction method: A: Explained system.in this thing. It is actually the standard input stream, corresponding to the keyboard entry B: Construction method InputStream is = system.in; Scanner (InputStream is) C: Common format Scanner sc = new Scanner (system.in); (3) Basic method format: A:hasnextxxx () Determines whether a type of b:nextxxx () returns some type of element (4) to master the two methods A:public int nextint () B:public string nextline (5) A small problem to note a: The same scanner object, get the value first, and then get the string there will be a small problem. B: Solution: A: Redefine a scanner object B: Get all the data in a string and then convert the corresponding 2:string class overview and use (Master) (1) A string of multiple characters According to In fact, it can be converted to a character array. (2) Construction method: A:public string () B:public string (byte[] bytes) C:public string (byte[] Bytes,int offset,int Length) D:public string (char[] value) E:public string (char[] value,int offset,int count) f:public Str This one under ING (string original) is not a construction method, but the result is also a string object g:string s = "Hello"; (3)Character of the string A: Once the string is assigned, it cannot be changed. Note: This refers to the contents of the string cannot be changed, not the reference cannot be changed. B: The literal value as a string object and the different string s = new string ("Hello") created by constructing the object, and the difference between string s = "Hello"? (4) The face question of the string (see program write result) a:== and Equals () string S1 = new String ("Hello"); String s2 = new string ("Hello"); System.out.println (S1 = = s2);//False System.out.println (S1.equals (S2));//true String s3 = new Stri Ng ("Hello"); String s4 = "Hello"; System.out.println (s3 = = S4);//False System.out.println (S3.equals (S4));//true String s5 = "Hello"; String s6 = "Hello"; System.out.println (S5 = = s6);//True System.out.println (S5.equals (S6));//True B: concatenation of strings Strin G S1 = "Hello"; String s2 = "World"; String s3 = "HelloWorld"; System.out.println (S3 = = S1 + s2);//False System.out.println (S3.equals ((S1 + s2));//True SYSTEM.O UT.println (s3 = = "Hello" + "world");//False This we are wrong, should be true System.out.println (s3.equals ("Hello" + "world");// True (5) string function (self-complement method Chinese meaning) A: Judge function Boolean equals (Object obj) boolean equalsignorecase (Stri Ng str) boolean contains (String str) Boolean startsWith (String str) Boolean EndsWith (Stri Ng str) Boolean isEmpty () B: Gets the function int length () char charAt (int index) in T indexOf (int ch) int indexOf (String str) int indexOf (int ch,int fromIndex) int indexOf (S Tring str,int FromIndex) string substring (int start) string substring (int start,int end) C: Conversion function byte[] getBytes () char[] ToCharArray () static String valueOf (char[] CHS) St atic string valueOf (int i) string tolowercase () string toUpperCase () string concat (string STR) D: Other functions A: Replace function string replace (char Old,char new) string Replace (string old,string new) B: Go to space function String trim () C: compare function by dictionary int compareTo (string str) in T Comparetoignorecase (String str) (6) string case A: Impersonate User login B: string traversal C: Count uppercase, lowercase, and numeric characters in the string D: the string Capitalize the first letter, other lowercase E: stitch an int array into a string of the specified format F: string inversion G: Count the number of occurrences of a large string of small strings *\
Java Basics (11) Summary of common classes (i)