Start JAVA learning from 0

Record my programming learning every week-Java 1

First, get to know JAVA

1. The birth of JAVA

        话说JAVA的故事那得从上世纪90年代说起,当硬件领域出现了单片式计算机系统,这种价格低廉的系统一出现就立即引起了自动控制领域人员的注意,因为使用它可以大幅度提升消费类电子产品(如电视机顶盒、面包烤箱、移动电话等)的智能化程度。
    就在这时**JAVA的母公司SUN公司**为了抢占市场先机,在1991年成立了一个称为Green的项目小组,帕特里克、詹姆斯·高斯林、麦克·舍林丹和其他几个工程师一起组成的工作小组在加利福尼亚州门洛帕克市沙丘路的一个小工作室里面研究开发新技术,专
    攻计算机在家电产品上的嵌入式应用。
        
        由于C++所具有的优势,该项目组的研究人员首先考虑采用C++来编写程序。但对于硬件资源极其匮乏的单片式系统来说,C++程序过于复杂和庞大。另外由于消费电子产品所采用的嵌入式处理器芯片的种类繁杂,如何让编写的程序跨平台运行也是个难题。
    为了解决困难,他们首先着眼于语言的开发,假设了一种结构简单、符合嵌入式应用需要的硬件平台体系结构并为其制定了相应的规范,*其中就定义了这种硬件平台的二进制机器码指令系统(即后来成为“字节码”的指令系统*),以待语言开发成功后,
    能有半导体芯片生产商开发和生产这种硬件平台。对于新语言的设计,Sun公司研发人员并没有开发一种全新的语言,而是根据嵌入式软件的要求,对C++进行了改造,去除了留在C++的一些不太实用及影响安全的成分,并结合嵌入式系统的实时性要求,
    开发了一种称为Oak的面向对象语言
    
    1995年,互联网的蓬勃发展给了Oak机会。业界为了使死板、单调的静态网页能够“灵活”起来,急需一种软件技术来开发一种程序,这种程序可以通过网络传播并且能够跨平台运行。于是,世界各大IT企业为此纷纷投入了大量的人力、物力和财力。这个
    时候,Sun公司想起了那个被搁置起来很久的Oak,并且重新审视了那个用软件编写的试验平台,由于它是按照嵌入式系统硬件平台体系结构进行编写的,所以非常小,特别适用于网络上的传输系统,而Oak也是一种精简的语言,程序非常小,适合在网络上传输。
    Sun公司首先推出了可以嵌入网页并且可以随同网页在网络上传输的Applet(Applet是一种将小程序嵌入到网页中进行执行的技术),并将Oak更名为Java(在申请注册商标时,发现Oak已经被人使用了,再想了一系列名字之后,最终,使用了提议者在喝一杯
    Java咖啡时无意提到的Java词语)。5月23日,Sun公司在Sun world会议上正式发布Java和HotJava浏览器。IBM、Apple、DEC、Adobe、HP、Oracle、Netscape和微软等各大公司都纷纷停止了自己的相关开发项目,竞相购买了Java使用许可证,
    并为自己的产品开发了相应的Java平台。
    
    1996年1月,Sun公司发布了Java的第一个开发工具包(JDK 1.0),这是Java发展历程中的重要里程碑,标志着Java成为一种独立的开发工具。9月,约8.3万个网页应用了Java技术来制作。10月,Sun公司发布了Java平台的第一个即时(JIT)编译器。
    
    2006年11月13日,Java技术的发明者Sun公司宣布,将Java技术作为免费软件对外发布。Sun公司正式发布的有关Java平台标准版的第一批源代码,以及Java迷你版的可执行源代码。从2007年3月起,全世界所有的开发人员均可对Java源代码进行修改
    2009年,甲骨文公司宣布收购Sun公司
     2011年,甲骨文公司举行了全球性的活动,以庆祝Java7的推出,随后Java7正式发布。2014年,甲骨文公司发布了Java8正式版

To sum up the above information, Java is an object-oriented language.

For programmers, this means paying attention to the data and the method of manipulating the data, rather than thinking strictly in terms of process. In an object-oriented system, a class is a collection of data and methods to manipulate data. Data and methods together describe the state and behavior of an object. Each object is an encapsulation of its state and behavior. Classes are arranged in a certain system and hierarchy so that subclasses can inherit behavior from superclasses. There is a root class in this class hierarchy, which is a class with general behavior. Java programs are organized by classes.

2. JAVA working principle

JAVA working principle diagram

3. JAVA JDK (development tool set)

JDK is a software development kit for the Java language, mainly used for java applications on mobile devices and embedded devices. JDK is the core of the entire java development, it contains the JAVA operating environment (JVM+Java system class library) and JAVA tools.

  Java目前的最新版本是:
Java15(截止到2020年)
Java8  LTS( 主流使用版本)
Java11 LTS
Java15 LTS
LTS:长期支持版

2. Introduction to JAVA Development Tools

1. Text editor

(1)记事本
(2)notepad++
(3)editplus
(4)Sublime Text
(5)VSCode

2. Integrated development tools

(1)Eclipse
(2)InteillJ IDEA
(3)MyEclipse
(4)NetBeans
(5)JCreator

Three, JAVA basic grammar

1. Basic data structure

There are four types of 8 data types in Java to store numeric values, characters and Boolean values.

(1)整数类型(byte short int long)
(2)浮点类型(float double)
(3)字符类型(char)
(4)布尔类型(boolean)

* Conversion of basic data structure

If small to big, turn directly;
big to small, need to force;

The basic types areLow to highRespectively
 
(byte,short,char)–int–long–float–double

2. Reference data structure

The presentation of reference types usually exists in the form of a class, which involves object-oriented programming in java.
Reference types in java include the following three categories:

(1)类的引用
(2)数组的引用
(3)接口的引用	

3. Keywords

Keyword (keyword)
Intercepted from Baidu
Intercepted from Baidu
Intercepted from Baidu

A keyword reference source. 1

4. Identifier

Identifier (identify)
identifier naming convention
see the name EENOW

  1. See the name

Try to use English words (or pinyin) to avoid using Chinese names

  1. Number cannot start
  2. No spaces between identifiers The special symbols supported by identifiers can only be "_" and "$"
  3. Do not use keywords to name identifiers. Do not use the built-in class names in the JDK as identifiers (for example, use String as a custom class name)

Recommended naming convention:

  1. Use lowercase English words for package names

  2. Class names are generally written in camel case (big camel case), with the first character of each word capitalized and the rest in lower case

  3. Method names and variable names use camel case (small camel case). Except for the first word (all lowercase), the first character of each word is uppercase. Custom constant names are all uppercase. If it is composed of multiple words, use between words "_"connection

5. Operator

Java provides a large number of operation symbols for manipulating data. These operation symbols are divided into the following categories:
1. Arithmetic operators
2. Relational operators
3. Boolean logic operations
4. Bit operators
5. Ternary operations
6. Others (extended assignment, string splicing, assignment, modeling)

Assignment operator

The assignment operator is represented by the symbol "=". It is a binary operator (processing two operands). Its function is to assign the value contained in the right operand to the left operand.
E.g:

  int a = 100;

Arithmetic Operator

+ Addition - Subtraction * Multiplication / Division% take the remainder
++ increment
- - decrement

Relational operator

<Less than
> greater than
<= less than or equal to
>= greater than or equal to
== equal to
! = not equal to

Boolean operation

|Logical OR
& Logical AND
! Logical NOT
||Short-circuit OR
(the expression on the left side of the operator is true, the expression on the right is no longer executed)
&& short-circuit and
(the expression on the left side of the operator is false, The expression on the right is no longer executed)

Bit operator

| Bitwise OR
& Bitwise and
~ inverse
^ Bitwise exclusive OR
<<Left shift
>>Right shift
>>>Unsigned right shift

For details on bit operations, see Baidu Encyclopedia

Trinocular operation

The ternary operator has the function of logical judgment.
Syntax:

布尔类型表达式 ? 结果1 : 结果2 

If the Boolean expression is true (true), return result 1;
otherwise, return result 2;

String splicing

Any data type connected with a string will be converted to a string type

	System.out.print("今天的天气为:" + 23 + "摄氏度" );

So much this week, see you next week. . . . . .


  1. Cay S. Horstmann. Java Core Technology (Volume I): Machinery Industry Press, 2008 ↩︎

Guess you like

Origin blog.csdn.net/m0_52074784/article/details/109426665