3 --- java language learning JAVA Basics

Here Insert Picture Description

1.Java Language Overview

  • The history of the development of Java language
    James Gosling (James Gosling)
    1977 was awarded a bachelor's degree in Computer Science, University of Calgary, Canada, in 1983, he received a doctorate in computer science from Carnegie Mellon University after graduation to work for IBM. IBM designed the first NeWS generation workstation system, but neglected.
    Later, go to the Sun, in 1990, cooperation "Green Plan" and Patrick, Naughton and Mike Sheridan and others, and later developed a language called "Oak", later renamed Java.
    Development Kit the Java
    1.0.2
    1.1.1 -> 1.1.6 -> 1.1.7 -> 1.1.8
    1.2.1
    the Java 2 SDK
    1.2.2
    1.3.0 -> 1.3.1
    1.4.0 -> 1.4.1 - > 1.4.2 -> 1.5.0 (5.0 in 2004 launched) -> 1.6.0 (6.0 in 2006 to exit) -> 1.7.0 (7.0 launched in 2011)
    jdk8 (launched in 2014) backward compatible version

  • Java language platform version
    J2SE (Java 2 Platform Standard Edition) Standard Edition
    is a solution for the development of ordinary desktop and business applications provide
    the technical system is the basis for the other two, you can do some desktop application development
    J2ME (Java 2 Platform Micro Edition) small version
    is the solution for the development of consumer electronics and embedded devices provided by
    J2EE (Java 2 Platform enterprise Edition) enterprise Edition
    for developing applications in an enterprise environment to provide a solution
    that contained technical system techniques such as Servlet, Jsp the like, mainly for the development of B / S Web application

    After jdk1.5, we changed its name to: JAVASE, JAVAME, JAVAEE

  • Java language features
    simplicity explanatory
    object-oriented high-performance
    distributed processing multithreaded
    robust multi-state
    structure neutral security
    open-source
    cross-platform JVM

2.Java cross-platform language principle!

1: What is cross-platform (platform specifies the operating system)
written in the Java language applications can run on different platforms.
2: the principle of cross-platform Java language
as long as the operating system needs to run java applications, install a Java Virtual Machine (JVM Java Virtual Machine) can be. By the JVM is responsible for running Java programs in the system.
3: Java language, cross-platform graphical
Here Insert Picture Description
because of the JVM, so the same Java program can be executed in three different operating systems. This realization of cross-platform Java programs. Also known as Java has good portability.
JAVA language is cross-platform, cross-platform rather than JVM.
JVM is not cross-platform, should be for different operating systems, JAVA provides a different JVM, while each operating system executable files are different

3.JRE and JDK overview!

  • What is the JRE
    Java Runtime Environment Java runtime environment
    includes the Java Virtual Machine (JVM Java Virtual Machine) and the required core class libraries and other Java programs, if you want to develop a good run Java programs, the computer can only need to install the JRE.
  • What is the JDK
    the JDK (Java Development Kit Java Development Kit)
    the JDK is available to Java developers, which contains the java development tools, including the JRE. So install the JDK, you do not have a separate installation of the JRE.
  • 为什么JDK中包含一个JRE
    其一,开发完的程序,总需要运行一下看看效果。
    其二,也是最重要的,JDK中的开发工具其实都是java语言编写的应用程序,为了方便使用才打包成exe文件,
    如果没有JRE,那么这些工具是运行不了的。
    D:JDK,JRE,JVM的作用和关系 我们用jdk编写了一个java程序交由jre 运行起来 由jvm实现跨平台
    使用JDK开发完成的java程序,交给JRE去运行

4.JDK的下载和安装过程图解!

  • JDK的下载
    a:官网 http://www.oracle.com
    历史版本下载网址:https://www.oracle.com/technetwork/cn/java/archive-139210-zhs.html
    针对不同操作系统,下载不同的JDK版本
  • JDK的安装
    a:傻瓜式安装
    双击安装程序,然后一路next即可(但是不建议)
    b:安装的推荐方式
    安装路径不要有中文或者特殊符号如空格等。
    所有和开发相关的软件最好安装目录统一。
    举例:我的JDK安装路径 D:\Java\jdk1.7.0_72
    当提示安装JRE时,可以选择不安装。建议还是安装上。
  • 验证安装是否成功
    a:通过DOS命令,切换到JDK安装的bin目录下。
    D:\Java\jdk1.7.0_72\bin
    b:然后分别输入javac和java,如果正常显示一些内容,说明安装成功

5.JDK安装路径下的目录解释

a:bin目录:该目录用于存放一些可执行程序。
	如javac.exe(java编译器)、java.exe(java运行工具),jar.exe(打包工具)和javadoc.exe(文档生成工具)等。
b:db目录:db目录是一个小型的数据库。
		从JDK 6.0开始,Java中引用了一个新的成员JavaDB,这是一个纯Java实现、开源的数据库管理系统。
	这个数据库不仅轻便,而且支持JDBC 4.0所有的规范,
	在学习JDBC 时,不再需要额外地安装一个数据库软件,选择直接使用JavaDB即可。
c:jre目录:"jre"是 Java Runtime Environment 的缩写,意为Java程序运行时环境。
		此目录是Java运行时环境的根目录,它包括Java虚拟机,运行时的类包,Java应用启动器以及一个bin目录,
	但不包含开发环境中的开发工具。
d:include目录:由于JDK是通过C和C++实现的,因此在启动时需要引入一些C语言的头文件,该目录就是用于存放这些头文件的。
e:lib目录:lib是library的缩写,意为 Java 类库或库文件,是开发工具使用的归档包文件。
f:src.zip文件:src.zip为src文件夹的压缩文件,src中放置的是JDK核心类的源代码,通过该文件可以查看Java基础类的源代码。

6.Java开发工具介绍

  • notepad(微软操作系统自带)
    其实就是咱们操作系统的中打开.txt文件使用的那个软件
  • Editplus/Notepad++
    是一款高级的文本编辑器,它相对notepad更好用一点。它们对java中的关键字都有颜色的变化,并且还有行号的提示。
  • Eclipse
    是一个IDE,它里面有一些代码提示的功能,相对于前面的开发工具更好用。(免费的)
  • MyEclipse
    和Eclipse相比较更方便,因为myEclipse中集成了很多的插件。(收费的)
    现在用的比较多的是idea。

7.path环境变量的作用及配置方式1

  • 在JDK的bin目录下开发程序容易产生的问题
    a:如果文件过多,不方便管理
    b:删除自己写过的不需要的文件,可能不小心把JDK自带的工具给删除了
  • 如何解决问题呢
    有这个想法来自于calc,或者notepad这样的命令为什么在任何路径下都能够执行,配置path环境变量
  • 配置方式
    • xp系统
      右键点击桌面计算机→选择属性→选择高级选项卡→点击环境变量→下方系统变量中查找path→双击path→将jdk安装目录下的bin目录添加到最左边并添加分号。
    • win7/win8系统
      右键点击桌面计算机→选择属性→选择高级系统设置→选择高级选项卡→点击环境变量→下方系统变量中查找path→双击path→将jdk安装目录下的bin目录添加到最左边并添加分号。

8.Path环境变量的配置方式2

  • 为什么会有第二种配置
    有很多技术的路径配置到我们的path环境变量中,比如: mySql,maven , webService(CXF)…
    这样呢?就导致了我们的path环境变量的内容比较多了。如果我们现在升级了我们的jdk,按照第一中配置方式,我们需要修改我们path变量。
    这个容易出现问题。
  • 步骤
    (1):先配置JAVA_HOME
    在系统环境变量中: 新建JAVA_HOME
    变量值=D:\Java\jdk1.7.0_72
    (2):再修改path
    在path前面添加: %JAVA_HOME%\bin;

9.classpath环境变量的作用及其配置

A:为什么要配置classpath
classpath变量是模仿我们的path变量做的,是为了让我们的字节码文件在任意路径下都执行
B:classpath配置的原理
C:如何配置classpath

path环境变量里面记录的是可执行性文件,如.exe文件,对可执行文件先在当前路径去找,如果没找到就去path环境变量中配置的路径去找
classpath环境变量里记录的是java类的运行文件所在的目录

10.Editplus的安装及开发程序并编译运行

  • 如何安装Editplus
  • 基本配置 工具----参数设置
    a:去除备份文件
    b:字体大小设置
  • 使用Editplus开发一个HelloWorld案例
  • 通过DOS窗口编译并运行

11.注释

11.1概述及其分类

  • 什么是注释
    用于解释说明程序的文字。
B:注释的分类及讲解
	(1): 单行注释  格式: // 注释的文字
	(2): 多行注释  格式: /* 注释的文字 */
	(3): 文档注释  格式: /** 注释的文字 */ (以后讲解)

11.2注释的作用

//A:解释说明程序
//B:帮助我们调试程序

12. Overview and use keywords

  • What is key
    is to be given a special meaning java language words.
  • Key features of
    letters are lowercase key
  • Common keywords
    class, public, static, void ...
  • Keyword Notes
    (1): goto and const java language are reserved words
    (2): Similar to editplus such advanced text editor for keywords are color change

13. identifiers

13.1 General and composition rules

"See-known name meaning"

  • What is the identifier
    character sequence is to be used when classes, interfaces, methods, variables, constants, etc. from the name
  • Composition Rules identifiers
    (1): English uppercase and lowercase letters
    (2): numeric characters
    (3): $ and _
  • Identifier Note
    (1): You can not start with a number
    (2): java is not the key
    (3): case sensitive

13.2 common identifier naming rules

A:包(就是文件夹,它的存在是为了解决我们同一个目录下不能同时存在两个相同名称的文件。)
	字母都是小写 itcast
B:类或者接口
	一个单词:	首字母大写,其余字母小写	Student , Teacher , Spring , Struts , Hibernate
	多个单词:	每一个单词的首字母都是大写,其余字母小写	 StudentName , UserLoginController
C:方法或者变量
	一个单词:	字母全是小写   name , age
	多个单词:   从第二个单词开始,首字母大写,其余字母小写  getName , getAge
D:常量
	一个单词:   字母全是大写		NAME , AGE
	多个单词:   字母全是大写,每一个单词之间使用 _ 隔开  STUDENT_MAX_AGE
Published 39 original articles · won praise 1 · views 529

Guess you like

Origin blog.csdn.net/love_to_share/article/details/104089252