1. First, open eclipse, and in the toolbar, click "File" >>> "New" >>> "Java project">>> Enter the name of the project (other default is OK) > >> "Finish"
2. Right-click on the "src" Directory of the project, then select "New" >>> "class" to create a new Java class, enter the name of the created class, and pay particular attention to the creation of the Main method.
3. The test code is as follows
Package test01;
Use of the String class
public class Test01 {
public static void Main (string[] args) {
TODO auto-generated Method Stub
String str1= "Wangwang";
String str2= "Wangwang";
SOP (Str1.charat (3));char charAt (int index) returns the char value at the specified index
SOP (Str1.compareto (STR2));//int compareTo (String anotherstring) compares two strings in a dictionary order
SOP (Str1.comparetoignorecase (STR2));//String Tiger drop case size after comparison size
}
Simplifies operation by changing the output function to call form
public static void Sop (Object obj) {
System.out.println (obj);
}
}
4. Right-click anywhere in the Java class and select "Run as" >>> "Java application" one at a time, meaning to run as a Java class, and here is the message from the console output. We successfully completed the creation of a Java project and compiled a Java class.
Eclipse Create Java Project program