JAVA简述

一 、高级语言的运行机制

计算机高级语言按程序的执行方式可以分为编译型解释型两种.

编译型语言是指使用专门的编译器,针对特定平台(操作系统) 将某种高级语言源代码一次性 "翻译" 成可被该平台硬件执行的机器码,

并包装成该平台所能识别的可执行性程序的格式,这个转换过程称为编译。

解释型语言是指使用专门的解释器对源程序逐行解释成特定平台的机器码并立即执行的语言。

解释型语言的优势 : 跨平台较易,解释型语言可以方便地实现源程序级的移植,但这是以牺牲程序执行效率为代价的。

解释型语言的劣势 : 每次执行解释型语言的程序都需要进行一次编译,因此解释型语言的程序运行效率通常较低,而且不能脱离解释器独立运行。

1.1、JAVA程序的运行机制和JVM

JAVA语言既不是纯粹的编译型语言,也不是纯粹的解释型语言。

JVM的作用:JVM是JAVA程序跨平台的关键部分,只要为不同平台实现了相应的虚拟机,编译后的JAVA字节码就可以在该平台上运行。显然,相同的字节码

程序需要在不同的平台上运行,这几乎是“不可能的”,只有通过中间的转换器才可以实现,JVM就是这个转换器。

JVM的组成部分:指令集,寄存器,类文件的格式,栈,垃圾回收堆,存储区。

JDK(Java SE Development Kit)即Java标准版开发包,

它提供了编译、运行Java程序所需的各种工具和资源,包括Java编译器、JRE(Java运行时环境),以及常用的Java类库等。

如果使用JDK1.5以上的版本,完全可以不用设置CLASSPATH环境变量。


1.2、HelloWorld.java

public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("HelloWorld.");
  }
}

javac命令:javac -d destdir srcFile

-d destdir是javac命令的选项,用以指定编译生成的字节码文件的存放路径,destdir只需是本地磁盘上的一个有效路径即可,

而srcFile是Java源文件所在的位置,这个位置即可以是绝对路径,也可以是相对路径。

例如:javac -d . HelloWorld.java

(.) 表示当前路径 , 此处的意思是把编译好的HelloWorld.class文件存放在HelloWorld.java同一个路径。


1.3、 Java源文件的命名规则及易错之处

一个Java源文件只定义一个类,不同的类使用不同的源文件定义。

让Java源文件的主文件名与该源文件中定义的public类同名。

Java语言是严格区分大小写的,安装Java相关程序、工具时,不要安装在带有空格的路径下。

1.4、 Java的垃圾回收机制

垃圾回收机制(Garbage Collection ,GC):Java语言不需要程序员直接控制内存回收, Java程序的内存分配和回收都是由JRE在后台自动进行的。JRE会负责回收那些不再使用的内存。

垃圾回收能自动释放内存空间,减轻编程的负担。所以Java虚拟机具有如下两个显著的优点:

1.  垃圾回收机制可以很好地提高编程效率。在没有垃圾回收机制时,可能需要花费很多时间来解决一个难懂的存储器问题。在用Java语言编程时,依靠垃圾回收机制可大大缩短时间。

2.  垃圾回收机制保护程序的完整性,垃圾回收是Java语言安全性策略的一个重要部分。

垃圾回收的一个潜在的缺点就是它的开销影响程序性能。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Intelligent Analytics for your Intelligent devices 针对智能设备的数据智能分析 Book Description Break through the hype and learn how to extract actionable intelligence from the flood of IoT data About This Book Make better business decisions and acquire greater control of your IoT infrastructure Learn techniques to solve unique problems associated with IoT and examine and analyze data from your IoT devices Uncover the business potential generated by data from IoT devices and bring down business costs Who This Book Is For This book targets developers, IoT professionals, and those in the field of data science who are trying to solve business problems through IoT devices and would like to analyze IoT data. IoT enthusiasts, managers, and entrepreneurs who would like to make the most of IoT will find this equally useful. A prior knowledge of IoT would be helpful but is not necessary. Some prior programming experience would be useful What You Will Learn Overcome the challenges IoT data brings to analytics Understand the variety of transmission protocols for IoT along with their strengths and weaknesses Learn how data flows from the IoT device to the final data set Develop techniques to wring value from IoT data Apply geospatial analytics to IoT data Use machine learning as a predictive method on IoT data Implement best strategies to get the most from IoT analytics Master the economics of IoT analytics in order to optimize business value In Detail We start with the perplexing task of extracting value from huge amounts of barely intelligible data. The data takes a convoluted route just to be on the servers for analysis, but insights can emerge through visualization and statistical modeling techniques. You will learn to extract value from IoT big data using multiple analytic techniques. Next we review how IoT devices generate data and how the information travels over networks. You’ll get to know strategies to collect and store the data to optimize the potential for analytics, and strategies to handle data quality concerns. Cloud resources are a great match for IoT analytics, so Amazon Web Services, Microsoft Azure, and PTC ThingWorx are reviewed in detail next. Geospatial analytics is then introduced as a way to leverage location information. Combining IoT data with environmental data is also discussed as a way to enhance predictive capability. We’ll also review the economics of IoT analytics and you’ll discover ways to optimize business value. By the end of the book, you’ll know how to handle scale for both data storage and analytics, how Apache Spark can be leveraged to handle scalability, and how R and Python can be used for analytic modeling. Style and approach This book follows a step-by-step, practical approach to combine the power of analytics and IoT and help you get results quickly Contents Chapter 1. Questions Chapter 2. Defining Iot Analytics And Challenges Chapter 3. Iot Devices And Networking Protocols Chapter 4. Iot Analytics For The Cloud Chapter 5. Creating An Aws Cloud Analytics Environment Chapter 6. Collecting All That Data – Strategies And Techniques Chapter 7. Getting To Know Your Data – Exploring Iot Data Chapter 8. Decorating Your Data – Adding External Datasets To Innovate Chapter 9. Communicating With Others – Visualization And Dashboarding Chapter 10. Applying Geospatial Analytics To Iot Data Chapter 11. Data Science For Iot Analytics Chapter 12. Strategies To Organize Data For Analytics Chapter 13. The Economics Of Iot Analytics Chapter 14. Bringing It All Together

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值