Some preliminary knowledge of Java learning and some simple Java applets

Source: Internet
Author: User

1 Learn some basic DOS commands first

Dir list files and folders in the current directory

MD Create Folder

Rd Delete folder (no sub files under file)

Del "folder name" to delete the folder of the tape file

CD: Move the folder directory one level back

Cd\ back to the root directory

Haha>1.txt create a document and write haha to a 1.txt document

Del 1.txt Deleting a file (without taking the Recycle Bin)

del *.txt only delete txt files

Exit quit command Line

After set, press ENTER to display the local environment variables that are configured well

Set path to view path

Set Path=haha only in the current command line state, change path, close the command line path is restored to the original state

Set path=haha;%path% temporarily add Path=haha as if it were above

Start opens a new command line under the command line

Set path= empty the environment variable

2. The Java EE represents the Enterprise Edition

J2SE represents the Standard Edition (just beginning to learn Java, one of the recommended versions)

J2ME represents the version of the java5.0 after the small version was renamed in order to be named as Java EE

3. The JRE represents the Java Runtime environment

JDK (note JDK package contains JRE) indicates Java SDK

JDK installation package: www.oracle.com or java.sum.com

4. Environment variable Settings

First, java_home indicates the JDK installation path, both the path selected at the time of installation D:\ jdk1.4

Second, in the System variables box, select Path, and then click the Edit button, at the end of the Edit System Variable dialog box that appears, add as:%java_home%\bin;%java_home%\jre\bin:

Third, the same method set the environment variable "classpath", whose value is.; %java_home%\lib\dt.jar; After%java_home%\lib\tools.jar, you can enter JAVA and Javac in the command line to see if the setting is successful (note: If there is a problem, you can change the setting path to add the contents as: C:jdk\bin;) 5. Identifiers can be letters, numbers, underscores, and (dollar signs), but numbers cannot be used as identifiers at the beginning of the note: The comment cannot use the keyword

6. Definitions and features of keywords, keywords such as int,double

Definition: Word features that are given special meaning by the Java language: All letters in the keyword are lowercase

7. Data type just need to know, do not require too much memorization, the use of the process of memory

(Note: Main is not a keyword but can be set up by the Java Virtual machine (the installation and environment variables of the JDK and JRE described earlier)

8.

Class Name: Capitalize the first letter of all words

Variable: First letter in lowercase, initial capitalization of climate word

Constants: All uppercase letters

9 It's a good idea to get into the habit of adding comments Java has three ways to annotate

One: Document comments (note: A recommended way to write a large program, for subsequent reading and development, this part of the comments can add author and time information, etc.):

/** This procedure solves the problem

Ideas

* 1,

* 2,

Steps

* *.

* *.

*/

Two: single-line Comment://Explain the contents of the description

Three: Multiline Comment:/* Explain the contents of the description */

A simple Java applet

// programs that convert decimal numbers into binary numbers  Public class c1{  publicstaticvoid  main (String args[]) {System.out.println (Integer.tob    Inarystring (6)); }}

 Public class c1{        publicstaticvoid  main (String args[]) {                int x= 4270;                x=x/1000+1000; // Note: x/1000                 System.out.println (x);                 SYSTEM.OUT.PRINTLN (/// Here is just how much is the left side of the% number, here the value of output is -2        }}

 Public class c1{            publicstaticvoid  main (String args[]) {                    byte a=3 ;                   // a=a+3; This will be an error, because A is 1 bytes and 3 is 4 bytes             }}

 Public class c1{            publicstaticvoid  main (String args[]) {                        System.out.println ( "Hahahahah" +                        "hahah"); // Branch write can run, output Hahahahahhahah         }}

 Public class c1{    publicstaticvoid  main (String args[]) {    System.out.println ( "5+5=" +5+5); // Result of error operation    System.out.println ("5+5=" + (5+5)); // correct     }}

 Public class    c1{   publicstaticvoid  main (String args[]) {System.out.println ( "Hello\nworld");   // System.out.println ("\" hello\ ""); //   char c= ' you ';               // This is possible, because C is two bytes and kanji is two bytes }}

In the widows system, the carriage return is represented by two characters, \ r and \ n
\b Delegate Backspace

Run results

Hello

World

// arithmetic Operations  Public class c1{public  staticvoid short s=4//  s=s+5;   // if it's not annotated, it's going to go wrong . // This will do the automatic conversion. }}

// Assignment Operations  Public class      c1{  publicstaticvoidint  a,b,c;    A=b=c=5;    System.out.println (a+ "," +b+ "," +C "); }}

The result of the comparison operator operation is either True or false.

such as: if (a!=4)

Some preliminary knowledge of Java learning and some simple Java applets

Related Article

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.