Some key points in the Java Learning Process

Source: Internet
Author: User
Tags java reference
Some of the key points in the Java learning process-general Linux technology-Linux programming and kernel information. The following is a detailed description. Let's talk about several major Java blocks. I Can't elaborate on them very much, because in fact each piece can be said a lot. Let's just talk about the key points or things that should be paid attention to when studying these blocks.



Value Type:

Although it is an object-oriented language, it is essential to use the numerical type. If you have mastered the numerical calculation and conversion rules of C in C learning, I think there should be no problem here. There are only two points to note: 1. Floating Point constants such as 14.0 are considered to be double type, and only float type can be added with the suffix f; 2. Integer constants are considered int type, but during compilation, the compiler can regard them as the minimum value that can represent the number. Therefore, byte B = 100; no error is reported.



Reference Type:

I also switched from C/C ++. In fact, the so-called reference type already exists in C ++, that is, there is a reference type when passing parameters, which should be considered from C, it is a pointer, but we cannot perform hard operations on it. So the focus here is: 1. All objects in Java are generated in the heap, so something similar to a pointer needs to point to it, that is, reference; 2. The reference operation is to reference the object. Except for the value assignment operation, there should be no operations for the reference itself, this is the difference between C pointer and Java reference.



Class and object:

This is a big piece. There are a lot of things. If you don't talk about it, let's talk about the following points: 1. Similarities and Differences between class methods, class attributes and member methods, and member attributes in loading, initialization, and usage; 2. usage of this () and super () in constructors; 3. Subclass loading, initialization, and construction; 4. Method overloading and overwriting; 5. polymorphism issues caused by overwriting. (Note: The application of polymorphism has no effect on attributes in terms of methods)

Function call parameter transfer:

If we regard the address value recorded by the reference type as the value of the reference type variable, all Java methods are called using the value transfer ?? If the value type is used, the address of the reference type is used.



IO stream:

Compared with C, Java input and output, especially input, are very troublesome, maybe because of object-oriented considerations? I don't know. Java provides a lot of IO streams, but we don't have to figure out all kinds of IO. We only need to know what functions the byte stream and the primary stream have, and how the primary stream is constructed above the byte stream, almost all the construction of pipeline streams is based on an existing byte stream, and its design allows us to look like a pipe, set the IO stream section until we get the IO object we want to use (for example, BufferedReader ). In the future, we can check the API again. I think the main classes are: FileReader, FileWriter, and BufferedReader. the out object is enough for text input and output. For other objects, I don't think it is necessary to read so much if I don't take the test. (I have been using Java for a year and a half, basically using BufferedReader and System. out)



Container:

I personally think that this is a Java programming tool, and my favorite class is: ArrayList (List) as a variable length array, HashMap (Map) used to create a search table, Set I rarely use, only some connections are used in the use of HashMap. By familiarizing yourself with these two classes, you can master the basic usage of the List, Set, and Map classes. In addition, the following helper classes should be mastered: Iterator and Collections. The Collections class provides some common tools for containers, such as sorting. When it comes to sorting, it involves the Comparator: Comparator. The ability to use the Comparator class allows you to customize sorting schemes for your own needs and classes.



AWT and SWING:

I personally think that Java has a very good encapsulation in the production of graphic interfaces. I have tried to learn MFC before. When MFC generates a graphic interface, it will help you generate some code, then let you add the code to implement the function at the specified position of the code. I am used to it. If I see something, I will not clear why I write it, I won't go down. I naturally want to find out what the code is, and I learned a lot from the results. Later I realized that some of them call WinAPI, as a result, I still do not use MFC. This is not to belittle the MFC. I believe that the MFC has its extraordinary advantages, but I personally think that its encapsulation is not doing well and it exposes too many things, which may improve flexibility. However, maybe I have no idea about it :(. Java has done a good job in this regard. You can use it to hide the lower-layer Implementation of the graphic interface and use it as an object for you, you only need to repair, modify, and modify the object, which is quite convenient.

As a beginner, I think the focus of AWT is the usage of several Listener files, layout format, and the usage of many Component files. (However, I think it is not too late to find the appropriate Component for learning when it is used)

However, because of my personal use, AWT and SWING are rarely used so far, so I am sorry for the inconvenience. Writing this doesn't tell you how to solve the problem, because each of them has a lot of writability, but I hope it can be a reference for beginners and help beginners read books in a targeted manner.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.