Java Learning path (4) Method

xiaoxiao2021-03-06  17

Java Learning path (4) Method

As a programming language, Java is the best way to write code. When you learn a class, you can write a simple example program to run, see what results, then call a few classes, look at the run results, this is very intuitive to learn the class And the memory is very deep. Then you should not meet the transfer code, you should think about it, if I don't write, change it, try it again. Remember which talker said that learning programming is a destruction process, putting the examples in the book, learning the documentation, after running, constantly trying with different ways, constantly trying to destroy the structure of the code, see What is the result? In this way, you will be very universal to master Java.

For example, we have compiled Hello World

Public class helloworld {

Public static void main (String [] args) {

System.out.println ("Hello World");

}

}

Many beginners are not very understood why the main method must define the public static void main (String [] args), can you write? Including that I have such questions when I just learned Java. Want to know the answer? Very simple, you change your name to run, see what the report is wrong, then analyze according to the error information; take the main PUBLIC, try to see, what is wrong; Static removes; don't know main Whether or not to pass a string [] array, change String [], change to int [], or string to try; do not know if you must write the Args parameter name, you can also change the args to another name, Look at how to run the results.

I did this when I learned Java, I made the Hello World program for seven or eight times, constantly run, analyze the results, and finally understand why MAIN method is defined.

In addition, I don't understand the beginning of Staic, Public, Private, Exception, Try {} catch {} finally {}, etc., etc., it is to run successfully on the example above, and then start to destroy it, constantly According to questions in your own heart, rewrite the program, see if it is possible to run, whether it looks like it, can you get expected results. Thus, although time is time, an example program has repeatedly destroyed several times. I have a thorough understanding of this related knowledge. Sometimes even deliberately write some wrong code to run, see if it is expected to run error. This is to be profound for programming.

Specially worth mentioning is that JDK has a great debugging function, -verbose

Java? Cverbose

Javac? Cverbose and many other JDK tools have this option

-verbose can display where the command execution is loaded, and the JVM is listed in order, through these valuable debugging information, can help us analyze what JVM has done in the process of execution.

In addition, in the learning process, this destruction routine written, should be consciously divided into a separate class, the typical routine accumulated in the work should also be organized regularly, and there is a code base in the month. I have encountered a similar problem, to the Copy & Paste, Search & Replace in the code base, which greatly improves the development speed. The most ideal situation is to abstract some universal routines to abstract the first floor, form a universal class library, and have good packaging. Then it is more reusable. So I don't think it is not particularly necessary. If you write the destruction routine is the best example. If you really write the code you wrote, I highly recommend you to see the JDK underlying class library Java source code. In the JDK installation directory, there will be a src.zip, unope can completely see the entire JDK base class library, which is the Java source code of RT.jar, you can refer to how Sun is how to write Java programs, specification What is it like. When I study Java's class library, when some places are not very clear, or when you want more clear understanding of the details of the operation, you often open the source code of the corresponding class, through the source code, all The problem will be swept away.

Java Learning Path (5) Resources

1, http://java.sun.com/ (English)

Sun's Java website is a place where you should look often. Don't say more.

2, http://www-900.ibm.com/developerworks/cn/

IBM's DeveloperWorks website, English is good to go to English primary site. It is not only an excellent object-oriented analysis design website, but also a very good website of Web Services, Java, Linux. highly recommended! ! !

3, http://www.java-cn.com/ (Chinese)

Java Chinese Station, currently the most comprehensive domestic information, the most popular Java technology website, very popular. There are "Java Electronic Book", "Java Video Library", "Java Technical Work", "Java Source Base", "Java Tool Library", "Recruitment Search Plaza", etc., there are some experts. Column. There are currently more than 50,000 members, and nearly 1,000 VIP members. Whether it is a rookie or an old bird, you can find the stuff you need in this website! ! Better recommendation! ! ! ! ! !

4, http://www.javaworld.com/ (English)

Discussions and news about many new technologies in Java. I want to know more about the roof of Java, which is better here.

5, http://dev2dev.be.com.cn/index.jsp

BEA's developer garden, BEA as the most important App Server manufacturer, there are many unique technologies, friends who have developed on WebLogic are not missed.

6, http://www.huihoo.com/

Gray fox power website, a professional middleware website, although not a professional Java website, but has a deep accomplishment in J2EE business application technology.

7, http://www.theserverside.com/home/ (English)

TheServerside is a well-known website for Java Server applications.

8, http://www.javaresearch.org/

Java research organizations, there are many excellent Java articles and tutorials, especially in JDO articles.

9, http://www.cnjsp.org/

JSP technology website, there are quite a number of Java articles and resources. 10, http://www.jdon.com/

JDON Forum is a Chinese J2EE Professional Technology Forum in the Nature. In many Java Chinese forums, JDON is a very high technical content, and the quality of post is very good.

11, http://sourceforge.net/

SOURGEFORGE is an open source software, which also has a very very rich Java's open source of open source.

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

New Post(0)