My Java learning experience talks 1

xiaoxiao2021-03-05  30

First article: Construction of programming environment

This section has just reported the school's Summer School. It will be to learn the bridge course of our computer. It is just Java. I have never touched Java, just I have been watching this thing is really very fire, as if Java The programmer annual salary is dozens of K, in fact, any experienceful programmer annual salary is due to dozens of k, then the language of the cattle, the learning is not good, use the no, still do not send salary, I Writing this thing is mainly your own study notes, I just want to share my experience and share it, I don't dare to call the first article: the programming environment

This section has just reported the school's Summer School. It will be to learn the bridge course of our computer. It is just Java. I have never touched Java, just I have been watching this thing is really very fire, as if Java The programmer annual salary is dozens of K, in fact, any experienceful programmer annual salary is due to dozens of k, then the language of the cattle, the learning is not good, use the no, still do not send salary, I Writing this thing is mainly your own study notes, I just want to share my experience and share it, I don't dare to say it is a tutorial. I am very stinking my Java level, so there is any mistake in the article. Everyone includes, many concepts I don't know very well, here is the most introduced my own learning method, give many hot blood youth points that have just learned!

I want to engage in java, first of all, JDK, don't ask me what JDK is? And I have to hold back the Java's recognition of Java just learned. I don't know what JDK is really sad, but I don't know. I don't know 2 days ago. Now it will be, everyone is, don't worry, we now Start.

Add this website to your favorites.

Http://java.sun.com, we will be the frequent visitor of this website, this is the hometown of Java, anything we want! There is also a software, I will mention it here - letting Kong Mountain Word 2005, the new technology on the computer is all in English, I want to grasp the front line, I must get used to reading English, in fact, the English in the tutorial is very simple, No "What is it forced?" Looking so hard!

download

The next step is to download JDK,

http://192.18.97.221/ECom/EComTicketServlet/BEGINB2BBECD7E107A23FD3A2EBC6AFB4011B/-2147483648/706699719/1/538238/538094/706699719/2ts /westCoastFSEND/j2sdk-1.4.2_06-oth-JPR/j2sdk-1.4.2_06-oth-JPR : 2 / J2SDK-1_4_2_06-windows-i586-p.exe

Find this link above, first download this software, if you are a domestic internet user, then you may be afraid that you are 1M broadband, download speed will not be faster than my current 56K cat, my download speed is fast 6K, huh, huh ... You will be too poor China's international export! But it doesn't matter, below this link is given you http://count.skycn.com/softdownload.php?id=3116&url=http://hn-http.skycn.net:8180/down/j2sdk-1_4_2-windows-i586. EXE

This is fast, the sky software is not to say! Now look at the file file name J2SDK-1_4_2_06-windows-i586-p.exe, size 52m. Don't make a mistake!

J2SDK-1_4_2_06-windows-i586-p.exe This file is a 1.4 version of JDK Windows installation file. This article is all based on Windows platform. Although I am now using all UNIX, but think about most The buddies have not fallen to use Linux, so if you have a problem, please send me an email, I am not talking here, I believe there is no one now use 98, so the system of Win2000 or more Both buddies can see my article to configure.

Then download this software

Foreign buddy

http://web.unbc.ca/~robert/jcreator 3.0/

Domestic buddy

Http://download.zol.com.cn/detail.php?softid=30275

Download these two software above, our preparations have been completed, start our exciting Java travel!

installation

Now run the first file we download, that is, J2SDK-1_4_2_06-windows-i586-p.exe, install it, don't ask me how to install it, I am programming literacy, but I don't know how to literate, if you don't know How to install, and your age has exceeded 25 years old, then I advise you to give up the programming, and the road to Rome, you can hang it on this tree!

There is a little attention when installing, it is best to choose all installations, when you appear below, remember to choose all 4 options, or you must remember your installation path, (like I gave you the legend Inside, our installation path is

C: /J2SDK1.4.2/

Because we will use it for a while!

If you have to do it for a long time, you should do it. Insurance, after the installation is complete, we restart your computer!

getting Started

Now I will introduce you to the document we just download, just we downloaded two files, the first is the compiler, the second is a text editor.

First introduce the second, you must remember, I now introduce the second, this is the Java editor! That is to say, you can use this Java program very convenient, it can show the grammar highlight! And if you are wrong, you can help you correct it. In fact, Java's program can write with notepads, but we don't have to make an article. It is more convenient to use a notfep. Similarly, If we write a Java program, use this JCREATOR more convenient to use Notepad! Let you explain you!

About the first, I will slowly explain it, you write the program, that is the source program, actually a text file, just like the suffix is ​​the .txt file, such files let us read. But the program we run in the computer is not a text file, which is a 2-encycloped file, which is the executable of the compiler according to the executable generated by your text file you give. The first file we download is a Java compiler! You have to give the compiler some source files! It can be said to be some instructions you give the compiler, then the compiler generates the runoff file you want according to your "instruction", which can be an MP3 playing software, which can be a chat software, saying that everyone should also you got it. I have taught me more than those universities, this is not what I said, the evaluation of people's speaking questions about me is: light and easy to understand. Environment variable setting

Ok, now I will teach everyone to set the environment variable.

You point my computer, then point the counter-property - advanced - environment variable, see no, I have not seen, I will give you a picture, but I am embarrassed, my operating system is English version, everyone makes it Look at it! Seeing the two boxes, there is no, the above is a user variable, one is a system variable! We change the system variable!

Let's introduce you to the environment variable. There are many variables related to the system. You set these variables to tell the operating system, that is, your XP, your Win2000, which is going to find something. For example, there is a variable of PATH, which is the variable we have to change today. It is simple to say that this path variable means that you enter a command under the command line prompt, the operating system will automatically specify the PATH variable. Try all the path, that is, you specify a certain path name, the system will automatically go to the program under those directories. If you have the same name as the name you entered, you will do it. If not, tell you This name "is not an external command is not internal command, can't find the file name. Don't tell me what you don't know what is the command line prompt, the big brother I can't stand you, give you a picture: (to start - Program - Attachment - Command Line Tips), let's know, the black box below is the command line prompt! It is the so-called DOS! 嘿嘿 ......

This is over, my desktop is all seen!

Back to the top question, find Path in the system variable, double click, we now modify it, pay attention to not delete existing text, those who are addressed by XP, is the path variable that Windows runs must be, In the end, I will move back, sometimes those words are too long, and it is not shown in space. OK is the last future

Enter a semicolon ";", these variables are started with a semicolon, and the beginning of a semicolon represents a new variable. Isn't you selected a folder when you install the first program? I am not letting you remember the folder you choose! Don't forget, there should be a bin directory in the folder you installed, there is a Java inside BIN. Exe's program, there is a Javac.exe program! LIKE THIS:

Have you seen the two programs? Remember the path in the address bar, copy it down, add it behind you want to edit the PATH environment variable, don't use the file name, only the two files are in the directory, my path is C: / JDK1.4 / BIN, like my path environment variable% systemroot% / system32;% systemroot%;% systemroot% / system32 / wbem; c: / kav6; c: / program files / common files / autodesk shared /; c: / Program Files / Backburner 2 /; C: / Program Files / Common Files / Ulead Systems / MPEG

After completing, it will become

% Systemroot% / system32;% systemroot%;% systemroot% / system32 / wbem; c: / kav6; c: / program files / common files / autodesk shared /; c: / program files / backburner 2/; c: / program Files / Common Files / Ulead Systems / MPEG

; C: /jdk1.4/bin

When you do this, your path variables are sure that I am sure, anyway, in the end, the black body is constant, the slope is part of me! Because the two files are under the same directory, they only use the lost directory name. In this case, the next time you lose Java and Javac in DOS, XP will automatically find these path names you now. After the input is over, it is determined that it is determined later, then open the command line prompt. Be sure to reopen a command line prompt window, just that cannot be used, should read it for it or the old environment variable, so we want Use a new, then you enter Javac to see if there is any reaction, then try Java more. If like this, you have shown that you have succeeded.

If you get "Javac is not an external command is not internal command, you can't find the file name", you must be a mistake, remember must be a semicolon, don't be logized, there is, etc. Well, such as this kind of error!

So, the first step of the Long March is over, our development environment has been touched, we will test your environment in the end now? Now open your notepad, you may be strange, why didn't you use the second software downloaded? In order to make you better understand the essence of Java, Java editor can't teach you how to use it, because it is too convenient, I think I will tell you 3 lessons, I can teach you how to teach you!嘿嘿 .... Don't use words, Word is also too easy to you, start us with notepad.

Below I will give you some code: You don't make a simple copy paste, familiar with a language is the best way to knock the code out, you must take a note in the notepad of my code! Can't be wrong, because any letters have errors, including punctuation, and finally can't compile your program! There is also what I warns you don't copy paste. Don't copy paste, I beg you! Only in this way, you can know how cool it will make you use Java editor! No way, you have to take this step, painful is painful.

PUBLIC Class Lee {

Public static void main (string args []) {

System.out.println ("Java Is Very Easy !!!");

}

What is all lost? Ok, then start your pain history, very few people can enter the program for the first time, let us see if you have such a bowed nose? There is only this, you can know how cool it will make you use Java editor!

Let us now test your procedure! Your Notepad is still open! ? You still remember that you have such a sentence.

"Public class lee {"?

The most important understanding in Java is class! (Now I said that you may not understand, don't worry so much, you will die first.) The public class is the name of the class we have to declared, the name of the class is Lee, this sentence means Say we declare a public class, this class name is Lee, where the public class is the keyword in java. The meaning of the keyword is that these words are Java regulations. If you can't be wrong, Lee is yourself The name of the definition is the name of the class, which may be Lee or LEE M or LEE Z. However, it is important to note that the name of the class cannot have spaces. The above Lee M, Lee Z is the name of the wrong class. If we are written, it is much better, and it will not violate the naming rule lee_m lee_z. In fact, the names of these classes are your own definition, that is, you can use any name you like, but the premise is that these names do not violate naming rules, and the naming rules have a big book, those are correct Those who are wrong, I don't know, but now we try to use it as much as possible.

Now, don't worry too much, let's first step first, it is compiled and debugging! ! The name of the source file in Java must be the same as the name of the class you declared in the code. Why do you understand it later, tell you today!

Now we have built a directory! Name arbitrarily, save this file inside the directory you just built, remember that the name of the file must be Lee. Java's compiler only recognizes the name of .java file, so you must save it when you save, then select "All Files" in the file type, enter "lee.java" in the name box, otherwise you save the file It will turn into a non-written document, the suffix name is .txt. That's right.

Then you enter your folder in your command line prompt, use DOS? Don't tell me you don't know! If I don't, I am not literate, find a book to see, let CD, DIR ... these orders mean! !

Then you enter

Javac Lee.java

Javac is the compile command we want, followed by Lee.java, is the full name of the name we want to compile.

If you really write the program code:

Maybe your output is like this:

D: / doc /> javac lee.java

l.java: 2: Cannot Find Symbol

Symbol: Class String

Location: Class Lee

Public static void main (string args []) {

^

L.Java: 3: Package System Does Not Exist

System.out.println ("Java Is Very Easy !!!");

^

2 Errors

That's right, you pork, I will let you lose, but you still lose the wrong, the place where the little arrow refers to you is wrong, your good Sknes have no uppercase, hurry to change, Change my source file. If you have the first time Javac Lee.java, there is no reaction! Then you are genius, Bill. Gates should have a glow! Now your file is more than Lee.class's file right? This file is the compiler to help us generate the program, you can run, it seems like a player, a game! You are still in that directory.

Java Lee, Java is the command of the running program we have to use, because Java's program is running in the Java virtual machine, so the program running Java is not as simple as other programs, we need to use the name of the Java class. To run the Java program, Lee is the name of the runoff file, but does not have an extension, that is, Java Lee, not java lee.class, this I don't know why? Ok, I will finish the car, see the output, the output is the content you hit, so the content in the player, the content in the homage can be changed, you can print out Any words you want! And we used

System.out.println ("Java Is Very Easy !!!); is the print function in Java!

Ok, I am here today!

Tomorrow you can see the books of Java, congratulations, you have become a Java programmer, have gone.

I will write to you with my courses! Welcome to communicate with me

Xdfbb@hotmail.com

It is a tutorial. I am also very stinking my own Java, so there is any mistake in the article, please include, a lot of concepts I am not very clear, here is the most introduced my own learning method, giving many Learn the programs of blood youth guidance!

I want to engage in java, first of all, JDK, don't ask me what JDK is? And I have to hold back the Java's recognition of Java just learned. I don't know what JDK is really sad, but I don't know. I don't know 2 days ago. Now it will be, everyone is, don't worry, we now Start.

Add this website to your favorites.

Http://java.sun.com, we will be the frequent visitor of this website, this is the hometown of Java, anything we want! There is also a software, I will mention it here - letting Kong Mountain Word 2005, the new technology on the computer is all in English, I want to grasp the front line, I must get used to reading English, in fact, the English in the tutorial is very simple, No "What is it forced?" Looking so hard!

download

The next step is to download JDK,

http://192.18.97.221/ECom/EComTicketServlet/BEGINB2BBECD7E107A23FD3A2EBC6AFB4011B/-2147483648/706699719/1/538238/538094/706699719/2ts /westCoastFSEND/j2sdk-1.4.2_06-oth-JPR/j2sdk-1.4.2_06-oth-JPR : 2 / J2SDK-1_4_2_06-windows-i586-p.exe

Find this link above, first download this software, if you are a domestic internet user, then you may be afraid that you are 1M broadband, download speed will not be faster than my current 56K cat, my download speed is fast 6K, huh, huh ... You will be too poor China's international export! But it doesn't matter, below this link is given you http://count.skycn.com/softdownload.php?id=3116&url=http://hn-http.skycn.net:8180/down/j2sdk-1_4_2-windows-i586. EXE is fast, the sky software is not to say!

Now look at the file file name J2SDK-1_4_2_06-windows-i586-p.exe, size 52m. Don't make a mistake!

J2SDK-1_4_2_06-windows-i586-p.exe This file is a 1.4 version of JDK Windows installation file. This article is all based on Windows platform. Although I am now using all UNIX, but think about most The buddies have not fallen to use Linux, so if you have a problem, please send me an email, I am not talking here, I believe there is no one now use 98, so the system of Win2000 or more Both buddies can see my article to configure.

Then download this software

Foreign buddy

http://web.unbc.ca/~robert/jcreator 3.0/

Domestic buddy

Http://download.zol.com.cn/detail.php?softid=30275

Download these two software above, our preparations have been completed, start our exciting Java travel!

installation

Now run the first file we download, that is, J2SDK-1_4_2_06-windows-i586-p.exe, install it, don't ask me how to install it, I am programming literacy, but I don't know how to literate, if you don't know How to install, and your age has exceeded 25 years old, then I advise you to give up the programming, and the road to Rome, you can hang it on this tree!

There is a little attention when installing, it is best to choose all installations, when you appear below, remember to choose all 4 options, or you must remember your installation path, (like I gave you the legend Inside, our installation path is

C: /J2SDK1.4.2/

Because we will use it for a while!

If you have to do it for a long time, you should do it. Insurance, after the installation is complete, we restart your computer!

getting Started

Now I will introduce you to the document we just download, just we downloaded two files, the first is the compiler, the second is a text editor.

First introduce the second, you must remember, I now introduce the second, this is the Java editor! That is to say, you can use this Java program very convenient, it can show the grammar highlight! And if you are wrong, you can help you correct it. In fact, Java's program can write with notepads, but we don't have to make an article. It is more convenient to use a notfep. Similarly, If we write a Java program, use this JCREATOR more convenient to use Notepad! Let you explain you!

About the first, I will slowly explain it, you write the program, that is the source program, actually a text file, just like the suffix is ​​the .txt file, such files let us read. But the program we run in the computer is not a text file, which is a 2-encycloped file, which is the executable of the compiler according to the executable generated by your text file you give. The first file we download is a Java compiler! You have to give the compiler some source files! It can be said to be some instructions you give the compiler, then the compiler generates the runoff file you want according to your "instruction", which can be an MP3 playing software, which can be a chat software, saying that everyone should also you got it. I have taught me more than those universities, this is not what I said, the evaluation of people's speaking questions about me is: light and easy to understand. Environment variable setting

Ok, now I will teach everyone to set the environment variable.

You point my computer, then point the counter-property - advanced - environment variable, see no, I have not seen, I will give you a picture, but I am embarrassed, my operating system is English version, everyone makes it Look at it! Seeing the two boxes, there is no, the above is a user variable, one is a system variable! We change the system variable!

Let's introduce you to the environment variable. There are many variables related to the system. You set these variables to tell the operating system, that is, your XP, your Win2000, which is going to find something. For example, there is a variable of PATH, which is the variable we have to change today. It is simple to say that this path variable means that you enter a command under the command line prompt, the operating system will automatically specify the PATH variable. Try all the path, that is, you specify a certain path name, the system will automatically go to the program under those directories. If you have the same name as the name you entered, you will do it. If not, tell you This name "is not an external command is not internal command, can't find the file name. Don't tell me what you don't know what is the command line prompt, the big brother I can't stand you, give you a picture: (to start - Program - Attachment - Command Line Tips), let's know, the black box below is the command line prompt! It is the so-called DOS! 嘿嘿 ......

This is over, my desktop is all seen!

Back to the top question, find Path in the system variable, double click, we now modify it, pay attention to not delete existing text, those who are addressed by XP, is the path variable that Windows runs must be, In the end, I will move back, sometimes those words are too long, and it is not shown in space. OK is the last future

Enter a semicolon ";", these variables are started with a semicolon, and the beginning of a semicolon represents a new variable. Isn't you selected a folder when you install the first program? I am not letting you remember the folder you choose! Don't forget, there should be a bin directory in the folder you installed, there is a Java inside BIN. Exe's program, there is a Javac.exe program! LIKE THIS:

Have you seen the two programs? Remember the path in the address bar, copy it down, add it behind you want to edit the PATH environment variable, don't use the file name, only the two files are in the directory, my path is C: / JDK1.4 / BIN, like my path environment variable% systemroot% / system32;% systemroot%;% systemroot% / system32 / wbem; c: / kav6; c: / program files / common files / autodesk shared /; c: / Program Files / Backburner 2 /; C: / Program Files / Common Files / Ulead Systems / MPEG

After completing, it will become

% Systemroot% / system32;% systemroot%;% systemroot% / system32 / wbem; c: / kav6; c: / program files / common files / autodesk shared /; c: / program files / backburner 2/; c: / program Files / Common Files / Ulead Systems / MPEG

; C: /jdk1.4/bin

When you do this, your path variables are sure that I am sure, anyway, in the end, the black body is constant, the slope is part of me! Because the two files are under the same directory, they only use the lost directory name. In this case, the next time you lose Java and Javac in DOS, XP will automatically find these path names you now. After the input is over, it is determined that it is determined later, then open the command line prompt. Be sure to reopen a command line prompt window, just that cannot be used, should read it for it or the old environment variable, so we want Use a new, then you enter Javac to see if there is any reaction, then try Java more. If like this, you have shown that you have succeeded.

If you get "Javac is not an external command is not internal command, you can't find the file name", you must be a mistake, remember must be a semicolon, don't be logized, there is, etc. Well, such as this kind of error!

So, the first step of the Long March is over, our development environment has been touched, we will test your environment in the end now? Now open your notepad, you may be strange, why didn't you use the second software downloaded? In order to make you better understand the essence of Java, Java editor can't teach you how to use it, because it is too convenient, I think I will tell you 3 lessons, I can teach you how to teach you!嘿嘿 .... Don't use words, Word is also too easy to you, start us with notepad.

Below I will give you some code: You don't make a simple copy paste, familiar with a language is the best way to knock the code out, you must take a note in the notepad of my code! Can't be wrong, because any letters have errors, including punctuation, and finally can't compile your program! There is also what I warns you don't copy paste. Don't copy paste, I beg you! Only in this way, you can know how cool it will make you use Java editor! No way, you have to take this step, painful is painful.

PUBLIC Class Lee {

Public static void main (string args []) {

System.out.println ("Java Is Very Easy !!!");

}

What is all lost? Ok, then start your pain history, very few people can enter the program for the first time, let us see if you have such a bowed nose? There is only this, you can know how cool it will make you use Java editor!

Let us now test your procedure! Your Notepad is still open! ? You still remember that you have such a sentence.

"Public class lee {"?

The most important understanding in Java is class! (Now I said that you may not understand, don't worry so much, you will die first.) The public class is the name of the class we have to declared, the name of the class is Lee, this sentence means Say we declare a public class, this class name is Lee, where the public class is the keyword in java. The meaning of the keyword is that these words are Java regulations. If you can't be wrong, Lee is yourself The name of the definition is the name of the class, which may be Lee or LEE M or LEE Z. However, it is important to note that the name of the class cannot have spaces. The above Lee M, Lee Z is the name of the wrong class. If we are written, it is much better, and it will not violate the naming rule lee_m lee_z. In fact, the names of these classes are your own definition, that is, you can use any name you like, but the premise is that these names do not violate naming rules, and the naming rules have a big book, those are correct Those who are wrong, I don't know, but now we try to use it as much as possible.

Now, don't worry too much, let's first step first, it is compiled and debugging! ! The name of the source file in Java must be the same as the name of the class you declared in the code. Why do you understand it later, tell you today!

Now we have built a directory! Name arbitrarily, save this file inside the directory you just built, remember that the name of the file must be Lee. Java's compiler only recognizes the name of .java file, so you must save it when you save, then select "All Files" in the file type, enter "lee.java" in the name box, otherwise you save the file It will turn into a non-written document, the suffix name is .txt. That's right.

Then you enter your folder in your command line prompt, use DOS? Don't tell me you don't know! If I don't, I am not literate, find a book to see, let CD, DIR ... these orders mean! !

Then you enter

Javac Lee.java

Javac is the compile command we want, followed by Lee.java, is the full name of the name we want to compile.

If you really write the program code:

Maybe your output is like this:

D: / doc /> javac lee.java

l.java: 2: Cannot Find Symbol

Symbol: Class String

Location: Class Lee

Public static void main (string args []) {

^

L.Java: 3: Package System Does Not Exist

System.out.println ("Java Is Very Easy !!!");

^

2 Errors

That's right, you pork, I will let you lose, but you still lose the wrong, the place where the little arrow refers to you is wrong, your good Sknes have no uppercase, hurry to change, Change my source file. If you have the first time Javac Lee.java, there is no reaction! Then you are genius, Bill. Gates should have a glow! Now your file is more than Lee.class's file right? This file is the compiler to help us generate the program, you can run, it seems like a player, a game! You are still in that directory.

Java Lee, Java is the command of the running program we have to use, because Java's program is running in the Java virtual machine, so the program running Java is not as simple as other programs, we need to use the name of the Java class. To run the Java program, Lee is the name of the runoff file, but does not have an extension, that is, Java Lee, not java lee.class, this I don't know why? Ok, I will finish the car, see the output, the output is the content you hit, so the content in the player, the content in the homage can be changed, you can print out Any words you want! And we used

System.out.println ("Java Is Very Easy !!!); is the print function in Java!

Ok, I am here today!

Tomorrow you can see the books of Java, congratulations, you have become a Java programmer, have gone.

I will write to you with my courses! Welcome to communicate with me

Xdfbb@hotmail.com

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

New Post(0)