Java Study Notes (Day 1)

Java is sensitive to upper and lower case letters;

The name of the Java source code file must be the same as the defined class or interface name, and then add the ".java" suffix;

The Java source program needs to be compiled into bytecode to be recognized. This requires the use of the "javac.exe" command of the JDK. When entering the command, the suffix ".exe" can be omitted;

When you enter the "java HelloJava" command to run the Java program, the compiled "java.class" file is run, but you do not need to enter the ".class" suffix;

Perspectives and Views: Perspectives are an additional layer of organization provided by the Eclipse workbench, that is, perspectives play the role of an organization that implements the layout of multiple views and a collection of available operations, and defines a name for this collection . Several commonly used perspectives are provided in the Java development environment of Eclipse, such as the Java perspective, the resource perspective, the debug perspective, and the team synchronization perspective. You can switch between different perspectives, but only one perspective can be used at a time. Views are mostly used to browse information hierarchies and display the properties of the active editor, while the Package Explorer view can browse the file organization of a project. Views can appear alone, or they can be stacked with other views in the form of tabs, they can have their own independent menus and toolbars, and the layout can be changed at will by dragging and dropping.

The package explorer view is used to browse Java elements in the project structure, including references to packages, classes, and class libraries, etc., but the main purpose is to manipulate the source code files in the project.

The console view is used to display runtime output results and runtime exception information.

The outline view displays an outline of the structured file currently open in the editor area, and lists structured elements whose content is editor-specific.

The syntax highlighted by the Java editor includes: program code comments, Javadoc comments, Java keywords, variables, strings.

Right-click on the left side of the Java editor and select the "Show Line Numbers" command from the pop-up shortcut menu to enable the function of displaying line numbers in the Java editor.

When writing Java program code, you can use the Ctrl+Alt+/ keys to automatically complete Java keywords, or use the Alt+/ keys to launch the Eclipse code assist menu.

Using Swing technology to write desktop applications in Java, all forms, menus, dialog boxes, buttons and other components are created using code, and rely on code to set properties of components and write event listeners.

Project applications developed in the Java language all need to use class library files, which are composed of multiple JAR files. JAR files are packaged files for Java. For example, Spring, Hibernate, Struts, etc. are currently popular framework technologies. If the developed project uses any of these frameworks, the JAR files in the framework must be added to the class library of the project, which is called the build path in Eclipse.

The advantage of the method of adding a library is that the class library is clearly classified, which is convenient for management and analysis. The disadvantage is that the JAR files managed by the library are in the local disk. If you simply copy the project folder to other computers, or move the JAR files associated with the class library to other folders, the specified user library will lose its effect and the project will have errors. , then the user needs to re-specify the JAR file location of the custom user library, or use another user library.

The Java project in Eclipse contains the src and bin folders, where the src folder stores the Java source code files, and the bin folder stores the compiled class bytecode files. JAR files are compressed from these bytecode files, so these class files should be able to be added to the build path instead of JAR files.

Program debugging: Step over, press F6 to perform a single step over operation, it means to run a single line of program code without entering the inside of the debug method, then skip the next executable point and suspend the thread. Continuously performing a single-step skip operation will execute one line of program code at a time until the program ends or waits for user action. To step in, pressing the F5 key will step into the calling method or object's internal stepper and suspend the thread.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325770255&siteId=291194637