Java编程新手自学手册.pdf

收藏

编号:20200522104840158196    类型:共享资源    大小:18.77MB    格式:PDF    上传时间:2020-05-22
  
1
文币
关 键 词:
Java 编程 新手 自学 手册
资源描述:
新手学编程 ABC 丛书 Java 编程新手自学手册 谭贞军 等编著 机 械 工 业 出 版 社 Java 是当今使用最为频繁的编程语言之一,一直在开发领域占据重要的 地位。本书循序渐进、由浅入深地详细讲解了 Java 的核心技术,并通过具体 实例的实现过程演练了各个知识点的具体使用流程。全书共 19 章,分为 4 篇。第 1~6 章是基础篇,逐一讲解了 Java 基础,Java 开发工具,Java 数 据,字符串、运算符和表达式,假设语句,循环语句等 Java 开发所必须具备 的基本知识。第 7~12 章是核心技术篇,逐一讲解了数组,面向对象,类, 异常处理,I/O 与文件处理,线程等知识;第 13~17 章是提高篇,逐一讲解 了网络与通信,AWT 开发窗体程序,窗口编程,数据库编程等知识。第 18、19 章是综合实战篇,分别通过画图板系统和网上书城系统的实现过程, 讲解了 Java 语言在日常项目开发中的综合应用流程,并穿插介绍了各个模块 的实现技巧。每篇最后为本篇的范例实战,通过实战演练帮助读者掌握本篇 知识。全书采用故事性、趣味性相结合的对话讲解方式,并穿插了学习技巧 和职场生存法则,引领读者全面掌握Java。本书附有 1 张DVD 光盘。 本书不但适用于 Java 的初学者,也适于有一定 Java 基础的读者,还可 以作为有一定造诣的程序员的参考书。 图书在版编目(CIP)数据 Java 编程新手自学手册/谭贞军等编著.—北京:机械工业出版社,2012.4 (新手学编程 ABC 丛书) ISBN 978-7-111-37937-9 Ⅰ.①J… Ⅱ.①谭… Ⅲ.①Java 语言―程序设计 Ⅳ.①TP312 中国版本图书馆 CIP 数据核字(2012)第 059507 号 机械工业出版社(北京市百万庄大街 22 号 邮政编码 100037) 策划编辑:丁 诚 责任编辑:杨 硕 责任印制:杨 曦 2012 年 8 月第 1 版·第 1 次印刷 184mm×260mm·34.75 印张·864 千字 0001―4000 册 标准书号:ISBN 978-7-111-37937-9 标准书号:ISBN 978-7-89433-496-1(光盘) 定价:89.90 元(含 1DVD) 凡购本书,如有缺页、倒页、脱页,由本社发行部调换 电话服务 网络服务 社 服 务 中 心: (010)88361066 销 售 一 部: (010)68326294 销 售 二 部: (010)88379649 读者购书热线: (010)88379203 封面无防伪标均为盗版 门户网: 教材网: 保定市中画美凯印刷有限公司 丛书序 III 丛 书 序 从《杜拉拉升职记》谈起 近年来,职场小说备受青睐,李可老师的《杜拉拉升职记》更是受到广大读者的喜爱, 还被搬上了银幕。对许多人来说,职场生涯占据了整个人生的很大一部分时间,怎样才能在 职场中如鱼得水,是人们必须认真思考的重要问题。即将走上程序员岗位的读者朋友们,请 自问是否已经对未来的职场生涯胸有成竹? 本丛书不但可以帮助初学者提前演练职场生活,而且对在职人员也有借鉴意义。技术方 面的知识就不用再多说了,每一页所包含的内容都是作者多年来的技术结晶。阅读本丛书 后,希望读者们不但能学到编程技术,而且能够提前体验到职场中的一些常见场景,为将来 的职场生涯做一些准备。希望本书能为读者们解惑,也希望能激励读者们在这个行业继续奋 斗下去,迎接大家的将是明媚的阳光。 程序员的各个阶段 按照掌握技术的熟练程度来划分程序员的不同阶段,可以大体分为 5 个阶段。 1)初学者:处在此阶段的可能是一名在校学生,可能是应届毕业生,也可能是准备从 其他行业向编程行业转行的人员。其共同特点是刚开始学习编程知识,对每一个知识点都充 满了好奇,对未来充满期望。 2)菜鸟:这里的菜鸟可能是技术菜鸟,也可能是职场菜鸟。特点是某项技术的基本知 识已经学习完毕,但是没有经过项目的洗礼,尚需要实战演练来磨练。这个阶段一般指处于 试用期或者刚刚从事程序员工作的人员。 3)初级程序员:对项目开发的基本流程有了初步的认识,并通过工作实战演练了自己 的技术。此阶段处于进一步与同事、上级、下级和客户交流的摸索阶段,也是逐渐融入职场 的一个阶段。 4)高级程序员:开发经验丰富,技术扎实,对同事关系、上下级关系和客户关系已经 如鱼得水,也是事业发展的瓶颈阶段。此阶段的程序员在职场中一般是软件高级工程师。 5)资深程序员:技术实力和人脉关系俱佳,一个项目任务能如探囊取物般轻松完成。 但是也对自己的未来充满思索,想寻求待遇更好的职位,会考虑跳槽,也会考虑创业。为了 表述得更加直观,下面通过一幅图来展示程序员的成长历程。 本丛书书目 根据综合考虑分析,本丛书首批书目如下。 C 语言编程新手自学手册 C#编程新手自学手册 Visual C++编程新手自学手册 Java Web 编程新手自学手册 Java 编程新手自学手册 PHP 编程新手自学手册 编程算法新手自学手册 Java 编程新手自学手册 IV 技术菜鸟或职场 菜鸟。特点是某 项技术的基本知 识 已 经 学 习 完 毕,但是没有经 过项目的洗礼, 尚需要实战演练 来磨练。 处在此阶段的可能是一名在校 学生,可能是应届毕业生,也 可能是准备从其他行业向编程 行业转行的人员。其共同特点 是刚开始学习编程知识,对每 一个知识点都充满了好奇,对 未来充满期望。 对项目开发的基本流程有了自己的认 识,并通过工作实战演练了初步的技 术。此阶段处于进一步与同事、上 级、下级和客户交流的摸索阶段,也 是融入职场的一个阶段。 开发经验丰富,技术扎实,对同事关 系、上下级关系和客户关系已经如鱼 得水,但也是事业进一步发展的瓶颈 阶段。 技术实力和人脉关系俱佳,一个项目 任务能如探囊取物般轻松完成。对自 己的未来充满思索,想寻求待遇更好 的职位。会考虑跳槽,也会考虑创 业。 丛书序 V 致读者 学习程序开发之路是充满挑战之路,也是充满乐趣之路,这条路没有捷径可走。梦想像 《天龙八部》中虚竹那样轻松获得一甲子功力,是不现实的。读者们要想真正学好编程,需 要付出辛苦的汗水。根据笔者的亲身体会,替读者总结出 3 条学习编程的建议。 (1)培养兴趣 无论做什么事情,只要有了兴趣,就喜欢花费时间去做它。只要喜欢感受那调试成功的 喜悦,就说明已经对编程产生了兴趣。这种喜悦会使自己更加喜欢编程,会带来成就感。闲 暇时刻建议多去专业编程论坛逛一逛,灌灌水。论坛里的朋友们不但能帮助自己解决问题, 而且还能带来其他非技术性的收获。 (2)脚踏实地 欲速则不达,学编程切忌有浮躁的心态。很多初学者刚学会了基本语法知识,调试成功 了几段代码,就迫不及待大声宣布: “我精通××语言了” 。但是当遇到问题之后才发现,自 己学到的只是九牛一毛。常说“书山有路勤为径,学海无涯苦作舟” ,是很有道理的。 (3)多实践 程序开发很强调实践动手能力,所以实践就变得尤为重要。有前辈高人认为,学习编程 的秘诀是“编程、编程、再编程,练习,练习,再练习” ,笔者深表赞同。学编程不仅要多 实践,而且要快实践。在看书的时候,不要等到完全理解了才动手,而是应该在看书的同时 敲代码,程序运行的各种情况可以让自己更快、更牢固地掌握知识点。 我们的服务邮箱是 150649826@ ,读者在阅读本丛书时,如果发现错误或遇到问 题,可以发送电子邮件及时与我们联系,我们会尽快给予答复。 丛书编委会 Java 编程新手自学手册 VI 前 言 Java 语言的重要性 Java 语言自正式发布起,经历了初生、成长和壮大的阶段,如今已经成为 IT 领域里的 主流编程语言。Java 应用之所以如此广泛,要归功于它的以下特点: (1)面向对象 Java 自诞生之时就设计成面向对象的语言。在 Java 眼里,一切都是对象,桌子和板凳 是对象,花草树木和飞禽走兽是对象,异常和错误也是对象。 (2)跨平台 不管是 Windows 平台还是 UNIX 平台或其他平台,Java 程序都适用。Java 编译器把 Java 源程序编译成与操作系统平台无关的字节码指令。只要安装了 Java 虚拟机,Java 程序 就可在任意的操作系统上运行。Java 程序中的字节码指令由 Java 虚拟机来执行,Java 虚拟 机的解释器解析字节码,对它进行转换,使之能够在不同的操作系统平台上运行。 (3)直接支持分布式的网络应用 假定网络中有两台主机,分别运行着不同的 Java 程序,运用 Java 套接字技术,这两个 Java 程序就能顺利地进行远程通信。 (4)安全性和健壮性 Java 致力于检查程序在编译和运行时的错误,奉行“错误发现和纠正得越早,造成的损 失就越小”的原则,做到防患于未然。Java 还支持自动内存管理,这不但为程序员减轻了负 担,也减少了程序员犯错的机会,同时还减少了内存出错的可能性。 本书的特色 本书的最大特色是以作者学习历程的日记为主线,用一问一答的模式引出知识点。本书 讲解了作者从一个入校新生学习编程开始,到顺利毕业并进入职场的成长历程。作者用日记 的格式全程记录了过去的学习历程,日记和学习、职场息息相关,也和知识点紧密相连,使 读者在阅读后有豁然开朗的感觉。 (1)成长经历为主线,以项目为单位,每个项目是一个故事 作者用日记格式记录了过去的学习历程,从作者学生时代讲起,一直贯穿整个学习过 程。以日记的方式记录下了学习过程中的点点滴滴,每个日记故事趣味和知识并重,情节引 人入胜。 (2)理论加实践的学习模式 书中遵循了理论加实践的写作模式,在每个知识点讲解完毕之后,都会用一个具体实例 来演练知识点的应用方法,且这些实例都具有代表性。 (3)揭示学习和职场经验 书中展示了一些职场中的规则和经验,逐一向读者展现了学习、应聘、同事关系、客户 关系、上下级关系、跳槽、创业和升职的经验和体会,以此启发读者,帮助读者在职场中少 走弯路。 前 言 VII (4)给读者以最大实惠 在配套光盘中不但有书中实例的源代码,而且有全程视频讲解的 PPT 素材。本书还免 费赠送给读者几个典型应用案例,并为书中的实际案例都配备了详细的视频讲解。 本书的内容 第 1 章 Java 基础 第 2 章 Java 开发工具介绍 第 3 章 Java 中的数据 第 4 章 字符串、运算符和表达式 第 5 章 Java 中的假设语句 第 6 章 循环语句 第 7 章 特殊数据——数组 第 8 章 Java 面向对象 第 9 章 类 第 10 章 异常处理 第 11 章 I/O 与文件处理 第 12 章 Java 线程 第 13 章 网络与通信 第 14 章 AWT 开发窗体程序 第 15 章 深入 Java 窗口编程 第 16 章 Java 和数据库 第 17 章 数据库编程 第 18 章 画图板 第 19 章 “众望书城”网上系统 本书的适用对象 初学编程的自学者 编程爱好者 大、中专院校的老师和学生 相关培训机构的老师和学员 第 1~6 章是基础篇,介绍了 Java 语言开发所必须具备的基本知识,逐一讲解 Java 基 础、开发环境的搭建、Java 基本语法、假设语句、循环语句等领域的知识,并采用理论 结合实例的方式对各个知识点进行了剖析。 第 7~12 章是核心技术篇,逐一讲解了数组、面向对象、类、异常处理、I/O 体系与文件 处理、多线程等领域的基本知识,并采用理论结合实例的方式对各个知识点进行了剖析。 第 13~17 章是提高篇,逐一讲解了和网络接轨、AWT 界面开发、Swing 编程、Servlet、 数据库编程等领域的知识,并采用理论结合实例的方式对各个知识点进行了剖析。 第 18、19 章是综合实战篇,分别通过了画图板系统和“众望书城”网上系统的实现过程, 讲解了 Java 语言在日常项目开发中的综合应用流程,并穿插介绍了项目的实现技巧。 Java 编程新手自学手册 VIII 毕业设计的学生 初、中级程序开发人员 程序测试及维护人员 参加实习的初级级程序员 在职程序员 资深程序员 致谢 本书的主要编写人员有谭贞军、陈强、张兴建、王梦、管西京、张子言、朱万林、李 强、周秀、王孟、陈德春、周涛、刘海洋、关立勋、孟娜、王石磊、徐亮、张储、蒋凯、扶 松柏、唐凯、焦甜甜、张斌、杨国华、杨絮、张玲玲。感谢作者们的辛勤汗水,也特别感谢 机械工业出版社的所有工作人员,从他们身上我们学到了严谨的工作态度。 读者服务 在编写本书的过程中,我们始终本着科学、严谨的态度,力求精益求精,但错误、疏漏 之处在所难免,敬请广大读者批评指正。再次声明,我们的服务邮箱是 150649826@ , 读者在阅读本书时,如果发现错误或遇到问题,可以发送电子邮件及时与我们联系,我们会 尽快给予答复。 感谢您购买本书,希望本书能成为您编程路上的领航者,祝您阅读快乐! 编 者 目 录 IX 目 录 丛书序 前言 第一篇 基 础 篇 第 1 章 Java 基础······················································································································· 1 1.1 认识 Java························································································································ 2 1.2 Java 初步························································································································ 2 1.2.1 Java 的起源············································································································· 2 1.2.2 Java 语言的特点······································································································· 3 1.2.3 Java 的一些名词解释································································································ 4 1.3 搭建开发环境················································································································ 5 1.3.1 获得 JDK················································································································ 5 1.3.2 轻松安装 JDK·········································································································· 7 1.3.3 JDK 配置如此简单··································································································· 8 1.4 体会 Java 程序··············································································································11 1.4.1 Java 输出“我喜欢你”····························································································11 1.4.2 编译和运行 Java 文件······························································································14 1.5 疑难问题解析···············································································································15 职场点拨——谈 Java 的重要性···························································································15 第 2 章 Java 开发工具介绍·······································································································17 2.1 认识 Java 的开发工具··································································································17 2.2 Java 开发工具简介·······································································································18 2.2.1 Eclipse 简介············································································································18 2.2.2 Netbeans 简介·········································································································19 2.2.3 JBuilder 简介··········································································································20 2.3 Eclipse 的获得与安装 ··································································································21 2.3.1 获得 Eclipse············································································································21 2.3.2 新建一个 Eclipse 项目······························································································22 2.4 NetBeans 的使用 ··········································································································27 2.4.1 下载 NetBeans·········································································································27 2.4.2 安装 NetBeans·········································································································29 2.4.3 使用 NetBeans 新建项目··························································································33 2.5 疑难问题解析···············································································································35 职场点拨——学习 Java 的正确态度 ···················································································35 Java 编程新手自学手册 X 第 3 章 Java 数据······················································································································37 3.1 量···································································································································37 3.1.1 常量······················································································································37 3.1.2 变量······················································································································39 3.2 数据类型·······················································································································43 3.2.1 简单数据类型值范围·······························································································43 3.2.2 字符型···················································································································44 3.2.3 整型······················································································································45 3.2.4 浮点型···················································································································46 3.2.5 布尔型···················································································································47 3.3 运算符···························································································································48 3.3.1 算术运算符············································································································48 3.3.2 关系运算符和逻辑运算符························································································50 3.3.3 位运算符················································································································53 3.3.4 条件运算符············································································································53 3.4 标识符和关键字···········································································································54 3.5 疑难问题解析···············································································································55 职场点拨——不同的客户,不同的处理方式·····································································55 第 4 章 字符串、运算符和表达式····························································································56 4.1 再看运算符···················································································································56 4.1.1 算术运算符············································································································57 4.1.2 关系运算符和逻辑运算符························································································62 4.1.3 位运算符················································································································64 4.1.4 条件运算符············································································································65 4.1.5 赋值运算符············································································································66 4.2 表达式···························································································································67 4.2.1 什么是表达式·········································································································67 4.2.2 表达式的优先级······································································································68 4.2.3 表达式的应用·········································································································68 4.3 字符串···························································································································70 4.3.1 字符串的初始化······································································································70 4.3.2 String 类·················································································································71 4.3.3 StringBuffer 类········································································································77 4.4 疑难问题解析···············································································································79 职场点拨——提高你的职场生存能力·················································································79 第 5 章 Java 中的假设语句·······································································································81 5.1 if 语句···························································································································81 5.1.1 if 控制语句·············································································································81 5.1.2 if 语句的延伸··········································································································83 目 录 XI 5.1.3 多个条件判断的 if 语句···························································································85 5.2 switch 语句 ···················································································································87 5.2.1 switch 语句的形式···································································································87 5.2.2 switch 语句无 break·································································································90 5.2.3 case 没有执行语句··································································································91 5.2.4 default 可以不在末尾·······························································································93 5.3 条件语句·······················································································································94 5.3.1 正确使用 switch 语句·······························································································94 5.3.2 正确使用 if 语句···················································································
展开阅读全文
  文库网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
0条评论

还可以输入200字符

暂无评论,赶快抢占沙发吧。

关于本文
本文标题:Java编程新手自学手册.pdf
链接地址:http://www.wenkunet.com/p-2185383.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

文库网用户QQ群:731843829    百度熊掌号:文库网精选     微信公众号:WENKUNET

copyright© 2018-2020 文库网 wenkunet.com 网站版权所有

经营许可证编号:粤ICP备19143267号-1 


1.png 2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png