CoreJavaSE9fortheImpatien

c#小王子 c#小王子 2021-09-03 764 Java


CoreJavaSE9fortheImpatien


Preface


Java is now over twenty years old, and the classic book, Core .Java, covers,in meticulous detail, not just the language but all core libraries and a multitude of changes between versions, spanning two volumes and well over 2,000 pages. However, ifyou just want to be productive with modern Java, there is a much faster. easier pathway for learning the language and core libraries. In this book, I don't retrace history and don't dwell on features of past versions.I show you the good parts ofJava as it exists today,with Java 9,so you can put your knowledge to work quickly.


As with my previous "Impatient" books, I quickly cut to the chase, showing you what you need to know to solve a programming problem without lecturing about the superiority of one paradigm over another.I also present the information in small chunks, organized so that you can quickly retrieve it when needed.


Assuming you are proficient in some other programming language,such as C++, JavaScript, Objective C, PHP, or Ruby, with this book you will learn how to become a competent Java programmer. Icover all aspects of Java that a developer needs to know,including the powerful concepts oflambda expressions and streams.I tell you where to find out more about old-fashioned concepts that you might still see in legacy code, but I don't dwell on them.


A key reason to use Java is to tackle concurrent programming. With parallel algorithms and threadsafe data structures readily available in the Java library, the way application programmers should handle concurrent programming has completely changed. I provide fresh coverage,showing you how to use the powerful library features instead of error-prone low-level constructs.


Traditionally, books on Java have focused on user interface programming—but nowadays, few developers produce user interfaces on desktop computers. If you intend to use Java for server-side programming or Android programming, vou wil be able to use this book effectively without being distracted by desktop GUI code. Finally, this book is written for application programmers, not for a college course and not for systems wizards. The book covers issues that application programmers need to wrestle with,such as logging and working with files—but you won't learn how to implement a linked list by hand or how to write a web server.


I hope you enjoy this rapid-fire introduction into modern Java, and I hope it will make your work with Java productive and enjoyable.


Chapter 1. Fundamental Programming Structures


Topics in This Chapter-


1.1Our First Program


■1.2 Primitive Types


1.3-Variables


1.4 Arithmetic Operations-


1.5 Srings


■1.6 Input and Output


■1.7 Control Flo


■1.8 Arrays and Array Lists


1.9 Functional Decomposition


■Exercise


In this chapter, you will learn about the basic data types and control structures of the Java language. I assume that you are an experienced programmer in some other language and that you are familiar with concepts such as variables, loops,function calls, and arrays, but perhaps with a different syntax.This chapter will get vou up to speed on the Java way. I will also give you some tips on the most useful parts of the Java API for manipulating common data types. The key points of this chapter are:


1.In Java, all methods are declared in a class. Youinvoke a nonstatic method on an object of the class to which the method belongs.

2. Static methods are not invoked on objects. Program execution starts with the static main method.

3.Java has eight primitive types: four signed integral types,two floating-point types,

char, and boolean.

4. The Java operators and control structures are very similar to those of C or JavaScript.

5. The Math class provides common mathematical functions.

6.String objects are sequences of characters or, more precisely, Unicode code

points in the UTF-16 encoding.

7. With the System.out object,you can display output in a terminal window.A

Scanner tied to System.in lets you read terminal input.

8.Arrays and collections can be used to collect elements of the same type.


1.1 Our First Program


When learning any new programming language, it is traditional to start with a program that displays the message"Hello, World!". That is what we will do in the following sections.


1.1.1 Dissecting the"Hello, World"Program Without further ado,here is the "Hello, World"program in Java. Click here to view code image


package ch01.sec01; 
//Our first Java program
public class HelloWorld {
   public static void main (String[] args){
      System.out.println ("Hello,World!");
   }
}


Let's examine this program:


·Java is an object-oriented language. In your program,you manipulate (mostly) objects by having them do work. Each object that you manipulate belongs to a specific class,and we say that the object is an instance of that class.A class defines what an object's state can be and and what it can do.In Java,all code is defined inside classes. We will look at objects and classes in detail in Chapter2. This program is made up of a single class HelloWorld.


·main is a method, that is,a function declared inside a class. The main method is the first method that is called when the program runs. It is declared as static to indicate that the method does not operate on any objects. (When main gets called, there are only a handful of predefined objects, and none of them are instances of the HelloWorld class.) The method is declared as void to indicate that it does not return any value. See Section1.8.8."Command-Line Arguments"(page 49)for the meaning of the parameter declaration String[] argS.


·In Java,you can declare many features as public or private,and there are a couple of other visibility levels as well. Here, we declare the HelloWorld class and the main method as public, which is the most common arrangement for classes and methods.


·A package is a set ofrelated classes. It is a good idea to place each class in a package so you can group related classes together and avoid conflicts when multiple classes have the same name. In this book, well use chapter and section numbers as package names. The full name of our class isch01.sec01.HelloWorld. Chapter2 has more to say about packages and package naming conventions.


·The line starting with // is acomment. All characters between // and the end o the line are ignored by the compiler and are meant for human readers only.●Finally, we come to the body of the main method. In our example,it consists of single line with a command to print a message to System.out,an object representing the "standard output"of the Java program.


As you can see, Java is not a scripting language that can be used to quickly dash off a few commands. It is squarely intended as a language for larger programs that benefit from being organized into classes, packages,and modules. (Modules are introduced in Chapter 15.)


Java is also quite simple and uniform. Some languages have global variables and functions as well as variables and methods inside classes. In Java, everything is declared inside a class. This uniformity can lead to somewhat verbose code, but it makes it easy to understand the meaning of a program.


【down load】

https://pan.baidu.com/s/1qMFOVQ1B1DrP0IMtHX0BLw

key:umdg


相关文章


使用-JFreeChart来创建基于web的图表

使用-JFreeChart来创建基于web的图表

XStream使用文档

XStream使用文档

WebService发布过程及常见问题

WebService发布过程及常见问题

webpack实战入门进阶调优分享

webpack实战入门进阶调优分享

weblogic调优参数及监控指标

weblogic调优参数及监控指标

weblogic节点管理

weblogic节点管理

weblogic管理控制台概述

weblogic管理控制台概述

weblogic-部署和启动

weblogic-部署和启动

WebLogic-Server-性能及调优-调优-Java-虚拟机

Java 虚拟机(Java virtual machine,简称 JVM)是一种虚拟“执行引擎”实例,可在微处理器上执行 Java 类文件中的字节码。调整 JVM 的方式会影响 Weblogic Server 和应用程序的性能。

Velocity用户教程

Velocity是一个基于java的模板引擎(template engine)。它允许任何人仅仅简单的使用模板语言(template language)来引用由java代码定义的对象。

Velocity用户手册

Velocity 用户手册是帮助页面设计者和内容提供者认识 Velocity 和其简单而功能强大的脚本语言――Velocity 模板语言(VTL)。在手册上的许多例子,都是用 Velocity 插入动态的内容到网页上,但是所有的 VLT 例子都能应用到其他的页面和模板中。


文章热度: 166291
文章数量: 333
推荐阅读

FlashFXP绿色版网盘下载,附激活教程 1782

FlashFxp百度网盘下载链接:https://pan.baidu.com/s/1MBQ5gkZY1TCFY8A7fnZCfQ。FlashFxp是功能强大的FTP工具

Adobe Fireworks CS6 Ansifa绿色精简版网盘下载 1565

firework可以制作精美或是可以闪瞎眼的gif,这在广告领域是需要常用的,还有firework制作下logo,一些原创的图片还是很便捷的,而且fireworks用法简单,配合dw在做网站这一块往往会发挥出很强大的效果。百度网盘下载链接:https://pan.baidu.com/s/1fzIZszfy8VX6VzQBM_bdZQ

navicat for mysql中文绿色版网盘下载 1623

Navicat for Mysql是用于Mysql数据库管理的一款图形化管理软件,非常的便捷和好用,可以方便的增删改查数据库、数据表、字段、支持mysql命令,视图等等。百度网盘下载链接:https://pan.baidu.com/s/1T_tlgxzdQLtDr9TzptoWQw 提取码:y2yq

火车头采集器(旗舰版)绿色版网盘下载 1707

火车头采集器是站长常用的工具,相比于八爪鱼,简洁好用,易于配置。火车头能够轻松的抓取网页内容,并通过自带的工具对内容进行处理。站长圈想要做网站,火车头采集器是必不可少的。百度网盘链接:https://pan.baidu.com/s/1u8wUqS901HgOmucMBBOvEA

Photoshop(CS-2015-2023)绿色中文版软件下载 1824

安装文件清单(共46G)包含Window和Mac OS各个版本的安装包,从cs到cc,从绿色版到破解版,从安装文件激活工具,应有尽有,一次性打包。 Photoshop CC绿色精简版 Photoshop CS6 Mac版 Photoshop CC 2015 32位 Photoshop CC 2015 64位 Photoshop CC 2015 MAC版 Photoshop CC 2017 64位 Adobe Photoshop CC 2018 Adobe_Photoshop_CC_2018 Photoshop CC 2018 Win32 Photoshop CC 2018 Win64

知之

知之平台是全球领先的知识付费平台。提供各个领域的项目实战经验分享,提供优质的行业解决方案信息,来帮助您的工作和学习

使用指南 建议意见 用户协议 友情链接 隐私政策 Powered by NOOU ©2020 知之