20165318 "Java Programming" experiment one (familiar with Java Development environment) experimental Report I. Experimental contents and steps (i) compiling and running a simple Java program using the JDK
- program development under the command line
Step One (new folder): Open the Git bash→ input command under Windows enter the cd java
Java directory → Enter mkdir 20165318test
to create a folder named after your own number → Enter the folder → cd 20165318test
Enter to mkdir exp1
establish "experimental One" folder → input enter cd exp1
" Experiment one "folder → input mkdir src
, mkdir bin
build src and Bin folder.
Step two (compile, run Java program): Use the Vim editor in Git bash to edit Java programs → Compile and run at the command line
(ii) Use idea to edit, compile, run, and debug Java programs
1, New "hellojdb" class, enter the following code:
2. Run "hellojdb", click the Run button (or use the Alt+Shift+F10
shortcut key)
3, set breakpoints, single-step operation.
Click on the left side of the line where you want to set a breakpoint, and a red dot appears. For example, set the breakpoint on line seventh as follows:
In the top Run
menu Debug...
, find Step-by-click (or use Alt+Shift+F9
shortcut keys):
Run to line seventh until the result is as follows:
Continue to step down to use Step Into
(shortcut key F7) and Step Over
(shortcut key F8)
① Step Over ( F8
): The program executes a line down (if the current line has a method call, this method will be executed and returned to the next line)
② Step into ( F7
): The program executes one line down. If the row has a custom method, run into a custom method (a method that does not enter the official class library)
③ Force Stepinto: Enter any method
④ Step Out ( Shift+F8
): If you enter a method while debugging and feel that the method is not a problem, you can use StepOut to jump out of the method and return to the next line of statements where the method is being used. It is worth noting that the method has been executed.
⑤ Run to cursor: Runs the program to the cursor.
You can use Resume
(shortcut key F9
) to run it directly, such as:
4. Conditional breakpoint
If you want to see the problems that occur in cycle, you can resolve them by using conditional breakpoints. If you set a conditional breakpoint as shown, use Resume
(accelerator F9
) to run directly from the previous breakpoint to this conditional breakpoint.
(iii) Exercise: implementation of the Caesar code and security Hardening and testing (normal, abnormal, boundary conditions)
" Requirements ": implemented via command line and idea two, practice debugging under idea.
20165318 "Java Programming" experiment one (familiar with Java Development environment) Experimental report