Java Basic knowledge

Source: Internet
Author: User

A Interactive mode

(1) graphical interface (GUI)

(2) command line mode (CLI)

Two Common DOS commands

(1) dir: Lists the files and folders in the current directory

(2) MD: Creating a directory

(3) Rd: Deleting a directory

(4) CD: Enter the specified directory

(5) CD. : Go back to the top level directory

(6) cd\: Return to the root directory

(7) Exit: Exit dos command line

Three two core mechanisms of Java

(1)Java virtual machine (JVM):theJVM is a virtual computer that is responsible for executing instructions, managing data, memory, and registers. For different platforms, there are different virtual machines. the Java virtual mechanism masks the difference between the underlying platform and implements the class "compile once, run everywhere".

(2) garbage collection mechanism (GC): Garbage collection is performed automatically during Java programs, and programmers cannot control and intervene precisely.

Four features of the Java language

• Feature one: Object oriented

Two basic concepts: classes, objects

Three main features: encapsulation, inheritance, polymorphism

• Feature two: robustness

It absorbs the advantages of C + + language, but removes the part that affects the robustness of the program. such as: pointers, memory applications and releases, etc.

• Feature three: cross-platform

Cross-platform: Applications written in the Java language can be run on different system platforms.

Rationale: Install a java vm (JVM Java virtual machine) as long as you need to run the Java application on the operating system Can. the JVM is responsible for the operation of the Java program in the system.

Five JDK and JRE

jdk (Java Development Kit : jdk is provided to &NBSP, Used by developers, including   JAVA  jre JDK and you don't have to install it separately.

JRE (Java Runtime Environment ) : includes java virtual machine (JVM:java Vsan) and java programs required for the core class library, and so on, if you want to run a well-developed Java Program, the computer only need to install the JRE can be.

Six Configuring Environment variables

() My Computer -- properties -- advanced system settings -- environment variable

() edit   path  JAVA  JDK  BIN  ;  "and other values separated.

(3) Open the DOS command line, typing javac in any directory . If the javac parameter information appears, the configuration succeeds.

Seven Executing java files

Javac Java source file name . Java

Java Java class name

Eight Details

(1)main method: The execution portal of the Java application is the main () method. It has a fixed writing format:publicstatic void Main (string[] args) {...}

If there is no main method, the following exception will be thrown at run time: Exception inthread "main" Java.lang.NoSuchMethodError:main

(2) There can be at most one public class in a Java source file . The number of other classes is unlimited, and if the source file contains a public class, it must be named for that class name.

Java Basic knowledge

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.