New knowledge of Java, zero-based learning

  1. Install JDK 1.8 64-bit version (especially the latest version is 1.8)

  The installation point is closed at the next and last point

  64-bit operating system can install 64-bit and 32-bit software

  32-bit operating system can only install 32-bit software

  2. Configure environment variables

  1>

  C:\Program Files\Java\jdk1.7.0_80\bin

  Copy this path

  Computer-> right-click-> properties-> advanced system settings-> environment variables

  Click New below

  Variable name: JAVA_HOME

  Variable value: C: \ Program Files \ Java \ jdk1.7.0_80 \

  Find Path

  C:\Program Files\Java\jdk1.7.0_80\bin;

  Detection:

  Press the Windows + R key, enter cmd, and press Enter. A black window appears, and the DOS command window appears.

  A bunch of information appears in java carriage return

  A bunch of information appears in javac carriage return

  Prove that the jdk environment variable is configured correctly.

  java-version detects jdk version

  Develop java:

  1. New text document

  2. Write java code

  3. Change the file extension to .java

  4. Press Windows + R to enter the javac file name.java in the current directory, this is the compilation

  5. java file name, this is run

  javac is the compile command

  java is run command

  javac HelloWorld.java will put the file HelloWorld.java

  Compile to HelloWorld.class file

  HelloWorld.class is a binary file, also known as a bytecode file

  Why compile?

  Because the .java file cannot be read by the computer, the computer can only read it after compiling it into a binary file

  We all know that computers only recognize 0 and 1 computers only recognize binary

  Binary octal decimal ...

  Life uses decimal 0 to 9 10 numbers

  \ t is a space Note: \ t must be inside double quotes

  \ n is a newline note: \ n must be inside double quotes

  System.out.println (); is the output statement

  public static void main(String[]args){}

  The entry point of the program is the main method

  class

  public

  static

  void no return value

  the name of the main method

  String

  System

  out out ..

  print printout

  Note: How many class files are there after compiling a java file?

  Answer: Not fixed, if there are several classes, several will be generated.

  A.java is called class A

  There can be only one public class in a file, other classes cannot be public

  Only one main method can exist in a class.

  // The line comment means that a line will be commented

  / * What to comment * / Multi-line comment

  Documentation notes

  /*

  *HelloWorld.java

  *2013-4-23

  * The first Java program

  */

  Note: Code specification

  Tools for developing java: text document Disadvantages: no prompt, no line number, no color ...

  The three most popular tools for writing java:

  Eclipse

  Myeclipse, we use Myeclipse

  idea

  Myeclipse is a plug-in for Eclipse, but later became more and more powerful, put Eclipse

  Incorporated into it, more powerful than Eclipse

  idea and webstorm are one.

  Install Myeclipse and crack and finish watching the video

  How to open the package explorer?

  Window-Display View-Package Explorer

  Change the font:

  Window-Preferences-General-Appearance-Color and Font-Basic-Text Font

  Save: Ctrl + S

  run:

  1. Right click-run mode -1 java run program

  2. Click the icon in the toolbar

  3. Right-click on the file-run mode -1 java run program

  hot key:

  Alt + / Code hint

  Ctrl + D delete a line

  How to write the main method quickly

  main then Alt + / Enter

  Quickly write output statements System.out.println ();

  syso then Alt + /

  Automatic prompt:

  Window-preferences-java-editor-content assist java automatic activation trigger on the right

  Quick copy: ctrl + alt + down arrow key (up)

  Do not copy: shortcut keys conflict

  hot key:

  MyEclipse shortcut key 1 (CTRL)

  -------------------------------------

  Ctrl + 1 quick fix

  Ctrl + D: delete the current line

  Ctrl + Q to locate the last edited place

  Ctrl + L to locate a line

  Ctrl + O quickly display OutLine

  Ctrl + T quickly display the inheritance structure of the current class

  Ctrl + W close the current Editor

  Ctrl + K quickly navigate to the next

  Ctrl + E quickly displays the current Editor drop-down list

  Ctrl + J forward incremental search (after pressing Ctrl + J, each letter editor you enter provides a quick match to locate a certain word, if not, it shows no found in the stutes line,)

  Ctrl + Z to return to the state before modification

  Ctrl + Y is the opposite of the above operation

  Ctrl + / Comment the current line, then press again to cancel the comment

  Ctrl + D delete the current line.

  Ctrl + Q jump to the last editing place

  Ctrl + M to switch the size of the window

  Ctrl + I Format Active Elements.

  Ctrl + F6 switch to the next Editor

  Ctrl + F7 to switch to the next Perspective

  Ctrl + F8 to switch to the next View

  ------------------------------------------

  MyEclipse shortcut key 2 (CTRL + SHIFT)

  ------------------------------------------

  Ctrl + Shift + E displays the manager that manages all currently open Views (you can choose to close, activate, etc.)

  Ctrl + Shift + / Auto comment code

  Ctrl + Shift + \ Automatically cancel the commented code

  Ctrl + Shift + O automatic boot class package

  Ctrl + Shift + J reverse incremental search (same as above, but only from back to front)

  Ctrl + Shift + F4 close all open Editor

  Ctrl + Shift + X all capitalize the currently selected text

  Ctrl + Shift + Y to change all currently selected text to lower case

  Ctrl + Shift + F format the current code

  Ctrl + Shift + M (first put the cursor on the class name of the package to be imported) The role is to add the Import statement

  Ctrl + Shift + P to locate the matching character (such as ()) (when positioning the back from the front, the cursor must be inside the matching character, and the back to the front, otherwise

  Ctrl + Shift + F Format Document Format Document.

  The effect of Ctrl + Shift + O is that the missing Import statement is added, and the redundant Import statement is deleted.

  Ctrl + Shift + S save all unsaved files.

  Ctrl + Shift + / is this / * ~ * / comment in the code window, and <!-~-> In the JSP file window.

  Shift + Ctrl + Enter inserts a blank line in the current line (the principle is the same as the above)

  -----------------------------------------

  MyEclipse shortcut key 3 (ALT)

  -----------------------------------------

  Alt + / Code Assistant completes the insertion of some codes and automatically displays prompt information

  Alt + ↓ Interactive position of the current line and the following line (especially practical, you can save the first cut and then paste)

  Alt + ↑ Interactive position of current line and upper line (same as above)

  Alt + ← Previous edit page

  Alt + → Next edit page (of course for the above one)

  Alt + Enter displays the attributes of the currently selected resource (project, or file or file)

  MyEclipse shortcut key 4 (ALT + CTRL)

  Alt + CTRL + ↓ Copy the current line to the next line (copy increase)

  Alt + CTRL + ↑ Copy the current line to the previous line (duplication added)

  -------------------------------------------

  MyEclipse shortcut key 5 (ALT + SHIFT)

  -------------------------------------------

  Alt + Shift + R rename

  Alt + Shift + M extraction method

  Alt + Shift + C modify the function structure (more practical, N functions call this method, modify it once

  Alt + Shift + L extract local variables

  Alt + Shift + F changes the local variable in Class to the field variable

  Alt + Shift + I merge variables

  Alt + Shift + V shift function and variable

  Alt + Shift + Z reconstructed regret medicine (Undo) Shift + Enter inserts a blank line in the next line of the current line (the mouse can be anywhere in the current line at this time, not necessarily the last)

  Alt + Shift + O (or click the Toggle Mark Occurrences button in the toolbar) When clicking a mark, this mark will be highlighted in yellow elsewhere on this page, and a white square will appear on the right border of the window. Click this square Will jump to this mark.

  The following shortcut keys are commonly used in refactoring.I like it and I often sort it out (note: the shortcut keys for general refactoring are all started with Alt + Shift)

  --------------------------------------------

  MyEclipse shortcut keys (6)

  --------------------------------------------

  F2 When the tooltip appears when the mouse is over a mark, press F2 to move the mouse away and the tooltip will also show Show Tooltip Description.

  F3 jump to the place of declaration or definition.

  F5 single-step debugging into the function.

  F6 single-step debugging does not enter the inside of the function. If Kingsoft PowerWord 2006 is installed, the shortcut key of "Word Switch" should be changed to something else.

  F7 is returned to the calling site from within the function.

  F8 is executed until the next breakpoint.

Guess you like

Origin www.cnblogs.com/javaxiachen/p/12707231.html
Recommended