Java Self-study chapter

Source: Internet
Author: User
Tags float double

Learning Java First Article

JAVA Learning Background

This would like to engage in the operation of the dimension is enough, to the community only to find the operation and development, want to learn python, but in the face of Big Data Java is the King , because it is big data 90% is practical java Write, learn Java first , this is the introductory article, hope to stick down, as long as adhere to success! Not for other for the future work good dry, while young, we struggle together, let learning become a habit!

I will not Java ha, let's study together, from the online down a basic Java Tutorial, looking at the previous several write the basis, I will summarize the first two chapters of knowledge. (I have limited knowledge, the article is not in the wrong place, please advise)

Chapter I. Content

1,java background Status quo history no need to see

2 . Features of Java

1) Advantages of Java

The advantages are platform-independent, write at once, run everywhere

Object-oriented programming speech, (object-oriented process-oriented differentiation??) )

2) new features compared to C + +

Provides automatic memory management capabilities

the pointer function of C + + is removed

Avoids confusion of assignment statements and logical operation statements

Removed the complex concept of multiple inheritance

3 . Key features of Java

1 simple and effective

2 Portability of programs written in Java, as long as fewer changes, and sometimes do not modify can be run on different platforms.

3 Object-oriented

4 Explanatory language

5 suitable for distributed Computing is ideal for developing distributed computing programs

6 has better performance

7 Robust, anticipatory

8 multithreaded processing capability

9 Higher Security

Dynamic Language, in the Java language can be simple, intuitive query running information; You can add new code to a running program

4. Java virtual machine (JVM)

a JVM is a bogus computer that can run Java code. (a virtual machine can explain the portability of writing multiple runs at once)

well-written programs run only on the JVM ,the JVM runs into each system, the system is different, but the JVM running in Java is the same, so the portability issue is explained

Java Technology Architecture

1,Java 2 Platform Enterprises Edition Enterprise version, the application of enterprise for environment development

2,j2se Java 2 Platform Stand Edition standard version, is a solution for desktop development and low-end business applications

3,j2me Java 2 Platform Micro Edition Small edition dedicated to consumer products and embedded devices of the best solution

JDK the Download

Loading of system environment variables

After the JDK is downloaded, follow the default installation to

Settings for System environment variables

Right-click My Computer - Properties - Advanced system Settings - environment Variables - system variable -path

650) this.width=650; "Width=" 314 "height=" 343 "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd; "alt=" Spacer.gif "/>

Hello World Programming (when you start learning every language is Hello World , presumably everyone is used to it)

public class Hello

{

publicstatic void Main (String args[])

{

System.out.println ("Hello world!");

}

}

Command-line mode

Compilation of Javac Hello.java

calls to the Java Hello class

Set Classpath=c:

The Set classpath command specifies the execution path of the Java class

the difficulty of the first chapter is JDK Download and environment variable settings, but also the focus of this chapter, what the advantages of what is said above, we do not use these things when programming, know that these advantages can be.

Chapter II: (The contents of the following should be written down)

First, simple procedure

public class Testjava

{

publicstatic void Main (String args[])

{

Intnum;

Num= 3;

System.out.println (" This is the number " +num);

System.out.println (" I have the +num+" book !) ");

}

}

1. The name ofthe file is consistent with the name of the public class

2 . Comments in the Java language are //

3. Public indicates that the class is a common class, and if a class is declared publicly , the file name is taken to the same class name, and in a Java file, there is a maximum of class, otherwise the file name of Java cannot be named.

4.from the start of the public static void main(String args[]) program,the 4-9 line is called themethod in Java called main()method

5, every independent Java program must have a main()method to run, he is the beginning of the program run

6,System.out refers to the standard output, the back println is composed of print and line, meaning that the contents of the following brackets printed output

two simple java Program parsing

1. Classes (class)

Java programs are made up of classes,

Publicclass Test// define Public class test

{

...

}

Public is a java keyword that refers to the way the class is accessed publicly.

Attention:

since Java programs are composed of classes, in a complete Java program, you need at least one class whose original program filename cannot be arbitrarily named, and must be the same as the name of the public class. Therefore, in a separate primitive program, there can be only one public class, but there are many non-public classes. If none of the classes in the program is public, the program name can be arbitrarily named.

2. Curly braces, segments and their bodies

{is the start tag for the class body,} The end identity of the class body

The end of each command must be a semicolon;

When a command's statement is more than a row, these statements must be included in a pair of curly braces to form a program segment (segment) or block.

3. Comments

single-line comment //

Document Comments /* * *

4. Identifiers

The names of packages, classes, methods, parameters, and variables in Java can consist of arbitrary uppercase and lowercase letters, numbers, underscores, dollar signs, identifiers that cannot start with a number, and keywords that cannot be reserved for practical use

5. Key Words

The keyword cannot be used as an identifier, and once used, the editor prompts for an error

6. Variables

Variables can be used to hold data, and a variable must first be declared with the data type it is pre-saved.

1) Declaration of variables

An int is a Java keyword that represents The declaration of an integer, separated by commas between each variable

2) variable data type int long short float double char string

3) The variable name keyword cannot be the name of the variable, in the principle of easy to remember

7, to maintain good indentation habits, to facilitate the clarity of the program

Tell yourself some words, insist on victory, let learning become a habit! Chapter Three we look at the idea of program design, hope that beginners and I struggle together!


This article is from the "Ops era" blog, please be sure to keep this source http://daomeng.blog.51cto.com/1655407/1795587

Java Self-study chapter

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.