Experiment with the familiar (Windows + idea) experimental content of a Java development environment
1. Compile and run a simple Java program using the JDK;
2. Edit, compile, run, and debug Java programs using Eclipse.
Experimental knowledge points
1.JVM, JRE, JDK installation location and difference;
2. command line run JAVAC;JAVA;JAVAC-CP; JAVA-CP;
The setting method and application of 3.path,classpath,sourcepath;
4. Package management: package;import;javac-d;
5.Eclipse (Netbeans) manages Java projects, debugging: Breakpoints, single step execution, etc.;
6.Java basic syntax: type and type conversion; variables; operators; Process control, etc.;
The use of 7.JDK help documents.
Experimental steps
- Simple use of the command line
1. Enter CMD to open the command line, locate the C drive, enter mkdir 20145239 to create a new folder, open and continue to enter mkdir EXP1 and then create a folder:
2. Enter javac-d. Helloworld.java compile and enter Java HelloWorld run:
- Debugging Java programs with idea
1. File->New->Project
Create a new Java project in the idea by following these steps:
2. From the Run menu, select Run ... Options to run:
1. Practice Title: Achieve the function of all prime numbers between the 1-n integers and test them.
2. Design code:
ImportJava.util.Scanner; Public class the Public Static voidMain (string[] args) {Scanner Scanner=NewScanner (system.in); System.out.println ("Please enter the maximum value of the range to query the number of primes:"); intN =Scanner.nextint (); intm = 0;intJ; for(inti = 2; I <= N; i++){ intK = (int) math.sqrt (i); for(j = 2; J <= K; j + +) if(I%j = = 0) Break; if(J >k) {System.out.printf ("%4d", i); M++; if(M = = 5) {System.out.println (); M= 0; } } } }}
3.IDEA Operation Result:
4. Command line Run Result:
The problem in the experiment and the solution process
Issue : The following error occurred while running at the command line:
solution : Return to the check code and find that one less line is written:
import Java.util.Scanner;
PSP (Personal software Process) time
Steps |
Time Consuming |
percentage |
Demand analysis |
5min |
5% |
Design |
20min |
20% |
Code implementation |
60min |
60% |
Test |
5min |
5% |
Analysis Summary |
10min |
10% |
Other (sentiment, thinking, etc., optional)
The need to get a little surprise, because once C language has done similar experiments, so there is a certain way of thinking. However, it is important to note the differences between Java and C languages.
Resources
- Java Learning Notes (8th Edition)
- Java Learning Note (8th Edition) Learning Guide
- Experiment with familiarity with a Java development environment
20145239 experiment with familiarity with a Java development environment (Windows + idea)