Dark Horse programmer-java

Source: Internet
Author: User

Dark Horse programmer-java
1. JAVA features 1) Simplicity (Java syntax is a "pure" version of C ++ syntax); 2) portability (one compilation is run everywhere) 3) Object-oriented 4) distributed (Java makes it very easy to enable socket connections and other complex network tasks) 5) robustness (the Java compiler will check errors that are displayed by many other languages at runtime; the pointer model adopted by Java can eliminate the possibility of overwrite memory and data crash. 6) multithreading (the simplicity of multithreaded programming is one of the main reasons why Java has become a popular server-side development language) security (Java can be used to build anti-virus and tamper-proofing systems) 9) Dynamic (Java can add new methods and instance variables at will, but the client does not need to make any changes) 10) architecture Neutral (bytecode has nothing to do with the computer architecture, as long as there is a runtime system, it can be executed on a variety of processors) 2. JAVA operating principle 1) Compilation :*. java file ------------> *. class file 2) Run :*. class file -----> load -----> JVM (JAVA Virtual Machine) 3. JAVA directory 1) JRE--runtime environment 2) SRC--class library 3) BIN---application (binary, JAVA tool) 4) demo--Example 5) include--C Language 4. JDK (Java Development Kit) JDK is the core of Java, including Java Runtime Envirnment ), A bunch of Java tools and Basic Java class libraries (rt. jar ). No matter what Java application server is actually built into a certain version of JDK. Therefore, mastering JDK is the first step to learn Java well. The most popular JDK is the JDK released by Sun. In addition to Sun, many companies and organizations have developed their own JDK, such as JDK developed by IBM and Jrocket of BEA, and JDK developed by GNU. Among them, the JVM (Java VirtualMachine) Running Efficiency in ibm jdk is much higher than that in Sun JDK. The Jrocket running on the x86 platform is much more efficient on the server than Sun JDK. However, we still need to Master Sun JDK first. 1) download and install JDK (JAVA development kit installation) 1. download (http://java.sun.com): JDK, also called J2SE (Java2 SDK Standard Edition), can be downloaded from Sun's Java website, http://java.sun.com/j2se/downloads.html, JDK is currently the latest version of J2SDK1.4.2, we recommend that you download JDK of this version. The download page is http://java.sun.com/j2se/1.4.2/download.html. 2. install (run shell in Linux): The downloaded JDK is an executable Installer. After the installation is completed by default: install a set of JRE under the \ Program Files \ Java \ directory (for use by browsers) and a set of JDK (including a set of JRE) under C: \ j2sdk1.4.2 ). Then we need to add the java path c: \ j2sdk1.4.2 \ bin at the beginning of the Environment Variable PATH. In this way, JDK is installed. 2) The most important command line tool of JDK: java: Start JVM to execute classjavac: Java compiler jar: Java package tool javadoc: java document builder these command lines must be very familiar with each parameter. JDK Documentation provides detailed documents on how to learn these commands. 5. Set environment variables (3): 1) csh (server) setenv JAVA_HOME/opt/java/jdk 1.5.0 _ 06 setenv PATH/opt/java/jdk 1.5.0 _ 06/bin: $ PATHsetenv CLASSPATH. 2) bsh/ksh (local) vi. bashrcexport JAVA_HOME =/opt/java/jdk 1.5.0 _ 06 // JDK installation PATH export PATH =/opt/java/jdk 1.5.0 _ 06/bin: $ PATH // The operating system itself, not export CLASSPATH =. // set it to a vertex. The default value is the current directory 3 ). check echo $ PATH .. bashrcjavajavac6, Class Loader: divided into four levels 1) start class loader $ jdk/jre/lib/rt. jar2) extended Class Loader $ jdk/jre/lib/ext

import java.lang.*;public class HelloJava{        public static void main(String[] args){       System.out.println("hello java, so simple");   }}

 

: Wq (2) Compilation: javac-d. ch01/HelloJava. java explanation: javac (enable compiler)-d. (in the current directory) ch01/HelloJava. java view directory: dir (-d function: create directory) if there is no package in the first line, you can save "-d. ", otherwise it must be added! (3) run: java com. briup. ch01.HelloJava (note that this is a complete name) if it is not in the current directory, use the command export CLASSPATH =? Modify the path (note? Indicates the directory name) ---------> generally, it is not easy to modify the configured path, so it is rarely used or temporarily run: java-cp? Com. briup. ch01.HelloJava

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.