Opening white: I still feel that there is a need for self-introduction to avoid everyone misunderstanding my master (in fact, just a poor vegetable green pole!).
I am a big lazy person, 2004.7 University graduate (professional: chemical). The first time I participated in July, the treatment was not bad. Unfortunately, there is an unexpected wind, one day in early September, I may have not woke up yet, I have written the resignation to the boss. I didn't look at the boss. (55! One night's heart! Continue crying, I Poor letters, 55), I ended my first job. There is no road to the sky (touch! God is really great to me), 2 days later, I appeared in a software company in Guangzhou, starting my programmer career. I have been studying Java for more than a month. I didn't understand programming at all (now I don't work hard now!), Basically self-study (even if the vegetable and vegetable birds are not as good). This article is purely some of my own learning experience, please give you a lot of guidance! Less nonsense, starting my long Java road. The wind is bleaks, the strong, the strong man is not worth *% ¥ # ... * (Do not lose the cabbage * ^ ------- ^ *) I immediately greeted the "thief boat" to accompany you!
This is really a thief boat, God, save me! God didn't answer but Buddha told me: Rape can't avoid it, then enjoy the eyes slowly! May the master bless you, Amen! ---- I rely, I service U. There is no way to live on this thief or to avoid being lost by God in the half-way, in order to reach the destination in this way without returning to the road, only the voyage is going to learn. In order to be able to live better, I decided to join a martial art. However, before this, I decided to do a big event first, that is ---- Eating first! (Don't fain, you, you can live! Hey ..) However, there is no one in the pocket, what can I do? "The sweet Javanese hoe, don't want money ..." A small MM's gentle voice came to my ear, "Don't want money!" I ran to which mm in XXX speed, grab a Javanese hoe In the mouth, "True" I haven't recovered, this small mm said "There is no free lunch in the world ..." I was forced to join this Java hoe helie, but I have to recognize this called Sun. Do a little more MM than my little MM! But there is no way, who told me to eat people's hoe. However, it is true, this kind of hoe is really quite fragrant, or the seniors such as IBM are old customers here. But the help of the Lord told me "This thief is now being ruled by a person called 'Bill', our goal is 'Kill Bill'", Khan ~~~ I didn't expect this accident. I became a revolutionary party. Fortunately, the helper is not bad, gave me a "peerless", the singer - a computer 1.1G computer, really is a peerless. It seems that there is also a cheat - haha, actually "Sunflower Collection", I will be invincible in the world. - Who knows that the cover is actually fake, the name inside is "Thinking in Java", a written written by it (I will only know Bruce Eckel), and I am like me .chm class is actually Free. How do I know that it is clear, you can get a free version and source code to http://www.bruceeckel.com. I rely! No matter, start cultivation! (The first station to configure the Java environment (the above purely practicing the fire "
First, you will prepare the prepared things, such as computer,% ¥ # (don't lose me).
First, JDK installation
JDK (Java Development Kits-Java Development Kit), also called J2SE is the core of Java, including Java Runtime Envir, you can download http://java.sun.com on Sun's Java website /j2se/downloads.html, downloading JDK is an installer that can perform, install JDK below the directory you want to install. For example, my is d: / java
Second, set environment variables
My operating system is Win2000. My Computer -> Right-click -> Properties -> Advanced -> Environment Variable.
Create a system variable under system variables, variable name: java_home Variable: Your JDK installation directory x: / xxx, such as my D: / Java
Add variable value variables to the system variable of the variable name:% java_home%;% PATH% or x: / xxx / bin; x: / xxx can use Java commands in any directory after setting, such as Javac, Java, etc.
Creating a new system variable variable name under system variable: ClassPath variable:.;% Java_home% / lib / dt.jar;% java_home% / lib / Tools.jar Note:% in front.; Can't be small, English input I haven't figured it out about the mechanism of ClassPath. I haven't figured it out later, I can use other Java extensions to add addresses to variables. Here our environment variables are set up, let me test our Java environment in our Java environment.
Third, the first Java program
Many tutorials teach us to start writing programs starting from helloWorld!, Many people written the first program is also "HelloWorld". Of course, I am also! Then I use this program to test whether our Java environment is configured.
I heard that many masters are written in memory, (sweating ... too boring) But I recommend UltraEdit for novices, I use UE write more colorful :)
The HelloWorld program is as follows:
Public class helloworld {public static void main (string [] args) {system.out.println ("HelloWorld!");}}
Save the file as HelloWorld.java, file name, and class name.
Enter: Javac HelloWorld.java Enter: Java HelloWorld Enter Screen appears: HelloWorld! Congratulations! Hehe Java's environment is all set here, we can concentrate on program ----- "Let's Go!
4. Analyze HelloWorld in the Java Application application, must have a class containing the main method. In this example, you must first use Class to declare a new class, which is called HelloWorkd, which is a public class (public). The entire class definition is enclosed by the braces. A main method is defined in this class. This method has three modifications, and its meaning is as follows: 1) PUBLIC: indicates that the MAIN method of this class can be used by all objects. 2) Static: Indicates that this method is a static method that can be called directly by class name. 3) Void: It does not return any values after the MAIN method is executed. This is very important because Java programming languages have a cautious type check, including checking the way the call does return the type declared by these methods. For an application, the MAIN method is required and must be defined in the format above. The Java interpreter executes the program as an entry without generating any instance. The Java program can define how many classes, each class can define multiple methods, but only one public class can only have one public class, and the main method can only have one, as the entrance of the program. In the main method definition, string [] args in parentheses is the parameter passed to the main method, the parameter name is ARGS, which is an instance in the String class. The parameters can be 0 or more, each parameter is specified with "class name parameter name", and the multiple parameters are separated from ",". In the main method, system.out.println (); used to implement the output of the string, use the println method of the Out object of the PrintStream class referenced by the owstem class OUT, will string "HelloWorld!" Standard output. In the Java programming language, a ";" represents the end of a statement. V. Java resources finally introduce several Java websites, not necessarily good! 1, http://java.sun.com/ (English) Sun Java website should always look at it. 2, http://gceclub.sun.com.cn/sun's Chinese technology community 3, http://www.javaresearch.org/ java, China Research organizations, there are many excellent Java articles and tutorials, especially in JDO articles rich in articles. 5, http://www.matrix.org.cn/ Dance 6, http://www.jdon.com/ JDON Forum, is a personal nature of Chinese J2EE professional technology forum, in many Java Chinese In the forum, JDON is a very high technical content, the quality of post is very good. 7, http://www.java-cn.com There are many resources such as e-books. Downloads are restricted, plus people inside are alive, so I don't like it.