20165318 "Java Programming" experiment one (familiar with Java Development environment) Experimental report

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.