Some key points that the Java learning process should understand in depth

Source: Internet
Author: User
Tags interface numeric key reference variable
The process is mainly to say a few large chunks of Java, can not be said very fine, because in fact, each piece can be said a lot, I will say these pieces of learning when the focus or should pay attention to things.






Numeric type:



Although it is an object-oriented language, but in the use of numerical type is still necessary, if the C learning has mastered the numerical calculation and transformation of C rules, then I think there should be no problem, only two points to note: 1, 14.0 such floating point constants are considered double type, Only with the F suffix is the float; 2, the integer constant is said to be int, but at compile time, it can be thought that the compiler sees it as the smallest number that can represent the digit, so byte B = 100;






Reference type:


Reference type:

I am also from C + + to turn over, in fact, the so-called reference type in C + + has been reflected, that is, when there is a reference type, from C to consider, it is a pointer, but we can not do it on the hard operation of the pointer. So the point here is: 1, Java all objects are generated in the heap, so need something like a pointer to it, that is, reference; 2, we refer to the object by reference, in addition to the assignment operation, there should be no action for the reference itself, This is where C's pointer differs from Java's reference.


Classes and objects:

This is a big chunk, there are a lot of things that don't unfold, just say a few points: 1, class methods, class attributes and member methods, member properties in the loading, initialization, use of similarities and differences; 2, in the constructor, this () and super (), 3, the loading process of the subclass, the initialization process and the construction process; 4, The overload and overwrite of the method, 5, the polymorphic problem caused by the overwrite. (Note: polymorphic applications are not useful for properties on methods.)


Parameter passing of a function call:



If the value of the address recorded by the reference type is considered to be a reference to the value of the type variable, then all the Java methods are invoked with the value passed.? Numeric types pass numeric values and reference types pass addresses.


IO stream:



Compared to C, Java input and output, especially input is very troublesome, perhaps because of object-oriented considerations? I don't know. Java provides a lot of IO streams, but we do not have to figure out all kinds of Io, we only need to understand the byte stream and the character streams have what function, the character stream is structured on top of the byte streams, almost all the character stream construction is based on an existing word throttling, And its design makes it possible for us to set up the IO stream section, like a casing, until we get the IO object we want to use (example: the use of BufferedReader). In our later use, we can go to check the API, I think the main to see a few classes are: FileReader, FileWriter, BufferedReader, and then with the System.out object, for the text input, output, it is enough to use, As for the rest, I don't think it is necessary to see so much in the exam. (I use Java 1.5 to basically use BufferedReader and System.out)


Container:


Personally, this is a great tool for Java programming, my favorite class is: ArrayList (List) as a variable length array, HashMap (MAP) used to build lookup table, set I rarely used, only in the use of HashMap and some. By being familiar with these two classes, you can master the basic usage of the list, set, and map three broad categories. In addition its several auxiliary classes to master: iterator and collections. The collections class provides some common tools for containers, such as sorting. And when it comes to sequencing, it involves a comparator: Comparator. Being proficient with the comparator class allows you to customize the sort scheme for your needs and your own classes.


AWT and Swing:


Personally think that Java in the production of graphical interface has a very good encapsulation, I used to try to learn that MFC,MFC will help you generate some code when generating a graphical interface, and then let you add code to the specified location of the code to implement the function, I have a habit, if let me see something, Then I do not make clear why so write, will not go down, see that a lot of code, naturally want to figure out what those are, the result leads to a lot of knowledge, then I know some of them are called WINAPI, and I still do not use MFC. Here is not to belittle MFC, I believe that MFC has its extraordinary place, but personally think it's not good encapsulation, exposing too many things, may be able to improve flexibility, however, I may not be with it: (. In this respect Java did a good job, give you a class, you use is, it will be a graphical interface of the low-level implementation of the hidden very well, as an object to you, and you only need to repair changes in this object, very convenient.

As a beginner, I think AWT's focus is on the use of several listener, the layout format, and then the usefulness and usage of the many component. (However, I think it's not too late to find the right component when you use it ^_^)

However, because of the reasons for my personal use, so far both AWT and swing are used very little, so this is also inconvenient to say, sorry. Writing this is not to tell you how to solve the problem, because each has a lot to write, just want to give beginners a little reference, hope to be able to help beginners to read the targeted.




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.