Some key points in the Java learning process

xiaoxiao2021-04-10  523

Some key points in the Java learning process

Mainly talk about the few blocks of Java, can't be said, because in fact, each piece can be said a lot, I will talk about the focus of these students or something should be paid.

Numeric type:

Although it is an object-oriented language, the value type is still essential, if you have mastered C calculations and conversion rules in C, then I don't think there is no problem, only two points need to pay attention. : 1,14.0 This floating point constant is considered a Double type, only plus the F suffix is ​​a Float type; 2, the integer constant is considered an int type, but when compiling, you can think that the compiler will look The minimum value is indicated, so Byte B = 100; will not report an error.

Quote type:

I also turned from C / C , in fact, the so-called reference type is already reflected in C , there is a reference type when passing, from C, it is a pointer, but we can't make a pointer to it. Hard exercise. So the focus here is: 1. All objects in Java are generated in the heap, so things that need to be similar to pointers point to it, that is, references; 2, we will use the reference to the object to reference, in addition to assignment In addition, there should be no operation is for the reference itself, this is the difference between C's pointer and Java's reference.

Class and object:

This is a big piece, there are many things, do not speak, say a few emphasis: 1, class method, class attribute and member method, member attributes are loaded, initialized, used in terms of use; 2, in the constructor , THIS () and super () usage; 3, subclass's loading process, initialization process, and constructive process; 4, overloading and overwriting; 5, overwriting the polymorphic issues. (Note: The application of polymorphisms is in the method, there is no effect on attributes)

Parameters passing the function call:

If the address value recorded by the reference type is as a reference to the value of the type variable, then when all method of Java is called, the value passes the value type, the reference type transmission address.

IO stream:

Compared with C, Java input and output, especially input is very troublesome, maybe because of the object-oriented consideration? do not know. Java offers a lot of IO streams, but we don't have to figure out all kinds of IOs. We only need to know what features each with the characteristics and characteristics, how the character stream is constructed on byte stream, almost all When the character stream is constructed, it is based on an existing byte stream, and its design makes we can set up the IO to one-section one section like a set of pipes until we want to Use the IO object (Example: BUFFEREDReader). When we use it later, we can check the API again. I think the few classes that mainly want to see are: FileReader, FileWriter, BufferedReader, with the System.out object, for the input of the text, it is enough Used, as for others, I don't think it's not necessary to see so much, I will see it again. (I used Java for a year and a half, basically in bufferedreader and system.out)

container:

Personally, this is a big tool for Java programming. My favorite class is: arraylist (list) as a variable length array, ishmap (map) is used to build a lookup table, and I am very useful, only in Hashmap Use a neutral band. By familiarity with these two classes, the basic usage of List, SET and MAP can be grasped. In addition, it has several auxiliary classes to master: Iterator and Collectes. The Collectes class provides some universal tools for containers, such as sorting. In terms of sorting, it involves the comparator: Comparator. Can skilled using the Comprator class, let you sort your needs and your own customs. AWT and SWING:

Personally, Java has a very good package in the production of the graphics interface. I used to try to learn MFC, MFC will help you generate some code when generating a graphical interface, then add code to the specified location of these code. With the implementation function, I have a habit. If I have seen something, then I don't know why you write, you won't go down, see that many of the code, naturally want to figure out what it is, what is it? The result is a lot of knowledge, and later I know that some of them are calling WinApi, and I still don't use MFC now. Here is not to degrade MFC, I believe that MFC has a matter of people, but personal thinks that its package is not doing well, exposes too much things, maybe it can improve flexibility, but maybe I will have no deeper with it: (. Java in this regard, give you a class, you are using it, it hides the low layer of the graphics interface, give you it as an object, and you only need to repair this object Modify changes, it is very convenient.

As an initiator, I think the focus of AWT is its number of listener's usage, and the layout format, then that many of the Component's use and usage. (However, I think, wait until you use it to find the right Component to learn, you should not be too late ^ _ ^)

However, because of my personal use, the AWT and SWING have been used very little, so this is not convenient, sorry. Write these is not to tell you how to solve the problem, because there is a lot of writings, just hope to give beginners, hoping to help beginners are targeted.

转载请注明原文地址:https://www.9cbs.com/read-133425.html

New Post(0)