Acquaintance of java

Acquaintance J AVA

1.JDK English name :: Java Developer's Kit

java Development Kit

2.path's role: to find the path. JDK in use anywhere in the directory bin executable program file folder to compile and execute the JAVA program.

System.oiut.println(‘helloworld’);

 

";" Path terminator, the statement terminator; Java case-sensitive, "()" method call

3. talk understanding of variables: the variables is data that can be changed, it can be long or short vary extended to shrink;

4. common DOS commands

command

Explanation

exit

close the window

cls

Clear screen

Letter:

Specified letter D: C: E:

cd change directory

Switching active directory at the same letter

cd full path such as: C: \ software \ everything

cd .. back to the previous

cd subpath into specific subdirectory

cd / letter

tab

Autocomplete

↑ ↓

Command history

5. First Program. The main errors are: the word wrong, wrong format, not up and running, our approach, more practice, more attention to detail

/ ** "XXXX" * /, which is the document notes, usually written on the front of the program, used to describe the program;

/ * "XXXXXX" * /, which is a multi-line comment, describe a method for running, and the like to achieve the effect;

// This is a single-line comments for the program under this section, the effect can be achieved, and so run the way described.

First Program

C ) , the template

 public disclosure of the public -> Access

 class class | classification (the same day of the same school have a common target feature) category

 Class Name : HelloSxt à capitalize the first letter of each word in the ...

public class HelloSxt{}

 

Entry point (main method)

public disclosure of the public -> Access

static static, fixed

empty void

main   main -> method name

() -> Priority, method

String [] args: Do not change it yourself. . . .

{} Method thereof

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

 

Write codewritten statement

System: System

out: an output terminal

println: print line , enter

() -> Priority, method

"" String

; End

System.out.println ( "hello sxt Welcome to Shangxue Tang");

System.out.println(1+1);

System.out.println(1==1);

 

Examples of most value : -> ctrl + s code to ensure that the final

 

2, compiled bytecode

javac  HelloSxt.java

 

Points to note:

  1. class behind the class name must be the same as the name of the folder;
  2. When a folder named, do not use Chinese characters, be sure to see to know the name of Italy, the first letter must be uppercase;
  3. There are braces, brackets must be the right flower wrap (left can not wrap), the second line must be indented (click "t of Able " key);
  4. Public static main (String [] args ) This statement "S Tring " must be capitalized;
  5. System.out.println (); this statement in the " System " must be capitalized, and the statement after the ";" must not forget.
  6. When compiling bytecode to use D OS command to open the file you want to compile the folder where the "Command Prompt" and enter javac add a space and the filename (suffix name) hit enter, then enter plus empty box java file name (without the suffix), and finally press the enter key, completion of compilation, the compiler will generate a complete suffix X- XXX. class file;
  7. Open a command prompt method:

A, R & lt window + , in the dialog box input cmd can;

B . Open directly to the control panel.

Guess you like

Origin www.cnblogs.com/ruanjianwei/p/11780989.html