First, start 1 download and install http://java.sun.com/j2se/1.4.1/download.html2 java vm http://www.java.com/en/index.jsp3 API http: // java. Sun.com/api/index.html1 First Download J2SDK Installation A Update Path Environment Variable In order to execute java commands (such as Javac, Java, et al) in any directory, you need to put Java's bin directory into the PATH environment variable. . For Windows95 / 98, open the Start menu, select "Run", enter the command sysedit (call the system configuration editor), find the PATH settings in the C: /autoexec.bat window (C: /JDK1.3.1) _01 / bin) For Windows NT and Windows 2000, enter the Start menu, select Set / Control Panel / System. For Windows NT, select the Environment page, for Windows 2000, select "Advanced" page, add in the user variable bar in the environment variable setting (if there is no PATH) or modify the PATH environment variable, make it included in C: / JDK1 .3.1_01 / bin path. b Update ClassPath Environment Variables In order to enable the system to find user-defined classes, you need to place the directory where the user class is located (usually the current directory is added to the classpath) is placed in the ClassPath variable. The specific changes method is used to modify the process, just to find the ClassPath environment variable for modification. Environment variable settings under JDK WIN2000
There is an environment variable setting in the advanced option of the properties of My Computer. 1) Adding a bin access path after the system environment variable Path parameter. For example, if it is directly installed under the C disk, add C: /jdk1.3.1/bin after the Path parameter. The results of the addition is generally:% systemroot% / system32;% systemroot%;% systemroot% / system32 / wbem; c: /jdk1.3.1/bin. 2) Creating a new system environment variable ClassPath, assigns its value to:.; C: /jdk1.3.1/lib/tools.jar; C: /jdk1.3.1/lib/dt.jar; C: /JDK1.3.1/ JRE / lib / dt.jar; D: / javaprogramming / where D: / javaprogramming / is the storage directory of the Java source program. Note: In the name of the source program of the source program, the name of the source program of the source, the same, that is to say that the java command is not ignored. In addition, the program name behind the java command is not to bring .class!
c Confirm that the system is installed under the DOS prompt, enter the set command to see if the PATH and CLASSPATH settings are successful (if it is 98 to run autoexec.bat to make the modified settings take effect if it is 2000 to turn DOS to turn off Re-Run) 2 Run your first Java program to write a class saved as .java file must remember if you save the name of the Notepad Editor, choose Save Types for all types and file names and your class names or you can Name. Java plus quotes to avoid saving the type .java.txt type.
3 Common Error Processing If you run the javac command, CAN not read xxx.java appears first to see if your file is saved as .java.txt type (the expansion name in the right point file) remember to remember File name. Java plus quotation marks saved. If you run the java command, you prompts Exception in thread "main" java.lang.noclassdeffounderroe: The exception indicates that you have not joined in your classpath. 2 Exception in thread "main" java.lang.noclassdeffounderroe: indicates that you have not added in your classpath.
3 Where is the difference between "==" and "equals ()"?
"==" is a fixed operator in Java, used to determine whether it is equal, and the usage comparison is single because of the basic type (int, char, boolean et al.), And "==" compares the object. In fact, it is the handle of the object (or the comparison of the address), so even if the content of the object is the same as "==", it is also different (unless: Object a = new Object () ojbect b = a ; if (a == b) system.out.println ("true"); in the case of the above program, the execution result is printed "TRUE"). Equals () methods have all objects in Java, because all classes in Java extends Object, so all classes may override the equals () method (object-oriented polymorphism), so equals () The method is also a comparison of two objects, but because the implementation methods in each class are different, it is not the same, as the content of the comparison is different, just like the String object of the upstairs String object () is used to compare the string object The contained string value is equal. Conclusion: == Usage Compare Single, is a inherent operator equals () method is a certain feature that can compare two objects as needed, very wide