Java Foundation _day01_java First intimate contact

Source: Internet
Author: User

Java Overview Three big platforms for Javaa Java SE (a Java m Platform D standard Edition): Java standards Platform, which allows the development and deployment of Java applications used in desktops, servers, embedded environments, and live environments, such as making a desktop version of Q Q,javase can provide a development foundation for Java EE and Javame.
a Java EE (a java m Platform e Enterprise Edition): Java Enterprise platform to help develop and deploy portable, robust, scalable, and secure server-side Java applications such as ERP for enterprise applications. Built on the Java SE, Java EE provides WEB services, component models, management, and communication APIs that can be used to implement enterprise-class service-oriented Architecture (SOA) and Web applications.
a Java ME (a Java Platform o micro Edition): Java Micro Platform, also known as K-java, used to develop mobile devices and embedded devices (such as mobile phones, PDAs, etc.). With the rapid development of Android, Javame is now using less and more, Android will gradually replace the javame market share.
 Other: Java as a development language of other platforms, such as Android, BlackBerry and other smart devices.


the cross-platform type of Java




Java virtual Machine (JVM)Java Virtual machine (Java VM), referred to as the JVM. is a virtual machine that runs all Java programs.
A Java virtual machine is not cross-platform. Only the corresponding version of the JVM can be installed under different operating systems.



Java Development Runtime EnvironmentBuild the Java Development run environmentJRE (Java E runtime Environment): Java Runtime Environment, to run Java programs, you need JRE,JRE
Contains the JVM.
JDK (Java T Development Kit): Java Development Toolset with Java development and run tools such as Javac and
Java and so on. The JDK contains the JRE.





Environment VariablesThe current code is located in the folder directory and JDK installation directory is not in the same directory, resulting in compilation and running difficulties. Can be resolved by configuring environment variable parameters.
Environment variables: Refers to some of the parameters used in the operating system to specify the operating system environment:




path: To run a program in any directory, you need to configure the path of the program in the Paths environment variable. Similarly, to compile a Java file under any directory, you can configure the directory where the Javac resides in path.
java_home: Specifies the root path of the JDK.
CLASSPATH:JVM the path where the bytecode is loaded at run time.

To Configure the environment variable mode:My Computer – Properties – Advanced – Environment variables.) Find the variable you want to modify and modify its value, or add a new environment variable.




install K JDK Note
JDK do not install in the path with Chinese characters and space character;
 Avoid C:\WINDOWS\system32 appear all the names start with Java file, have, delete;
 FAQ: "Javac is not an internal or external command" because of a path configuration error.


CLASSPATH Environment VariablesCLASSPATH: The path to the loaded bytecode file that represents the location of the JVM looking for a class file. such as:
CLASSPATH = c:\test is a Java command to go to the C:\Test directory to find the class file that needs to be executed. Starting from Java5 CLASSPATH is the current path by default, and it is generally not necessary to specify it.
If you use a previous version of Java5, set CLASSPATH to: (where. Represents the current path)




The first Java program









To run the compilation mechanism:
It can be seen that Java is both a compiled language and an interpreted language.

Java Development Notejava languages are strictly case-sensitive in spelling, like main and main are completely different concepts.
 Multiple Java classes can be defined in a Java source file, but at most one of these classes is defined as the public class. If the public class is included in the source file, the source file must have the same name as the public class.
 When a source file contains n Java classes, the compilation succeeds in generating an n-bit bytecode file, i.e. each class generates a separate class file with the same byte-code file name as its corresponding class name.



Basic Syntaxthree major notes


Note
 Multiple lines of comments and multi-line comments can not be nested use;
 Document comments and document annotations cannot be nested;
Multi-line annotations and document annotations cannot be nested with each other.
Summary of comments
The start comment symbol for multiline comments and document comments will find the nearest comment ending symbol, and find the middle of the
A paragraph as the whole of the annotation.

Java Language delimiter


Keywords and reserved wordsA predefined word in Java that has a special meaning and purpose, called a keyword.



reserved words : As with keywords, the programming language is defined beforehand but has no special meaning for the time being. Goto and const are reserved words for Java.
Attention
 keywords and reserved words are composed of lowercase, key words do not force memory, learn one to remember one.
java no sizeof, goto, const keywords
true, false, null some people call these three literals or literal values, but they are still Java keywords, because: in Java, a predefined word with a special meaning and purpose is called a keyword.

identifiersA name, called an identifier, that is customized to enhance program readability in programming.
JAVA identifier naming rules:
 Consists of letters, numbers, underscores, and $, but cannot start with a number (note: The letters here can be Chinese, Japanese, etc.).
 Case sensitive, that is, sensitive to casing.
 Do not use keywords and reserved words in Java.
 It is recommended that you do not use the class name in the Java API for your own class names.
Tips:
All you need to remember is that the identifier name uses a non-keyword and non-reserved word for meaningful English words.


EditPlus Toolseditplus: Tools to help develop Java programs, such as formatting checks, keyword checking, and content color tagging.
To set the compile Java command in EditPlus:

editplus Run Java command in the settings:



Java Foundation _day01_java First intimate contact

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.