《Thinking in Java 第2版》深度解析

需积分: 9 2 下载量 185 浏览量 更新于2024-09-19 收藏 3.98MB PDF 举报
"Think In Java 2 是一本针对Java学习者的权威书籍,由Bruce Eckel撰写,他是MindView, Inc.的总裁。这本书是第二版,预计在2000年6月中旬由Prentice-Hall出版。这本书的内容包括PDF版本,并在多个知名PDF相关网站上提供,如PlanetPDF,该网站提供了新闻、软件、白皮书、产品评论、Web链接、代码示例和由世界顶级PDF专家撰写的定期文章。" 《Thinking in Java》第二版是一本深受读者好评的Java编程书籍,被誉为比市面上其他Java书籍优秀许多,甚至有读者认为它的质量超出其他书籍一个数量级。它以其详尽全面的内容、直接且精确的实例以及深入浅出的解释而受到赞誉。与许多简化讲解的书籍不同,本书保持了成熟、一致、实事求是、文笔清晰和准确的风格,非常适合用于Java的学习。 书中涵盖了广泛的Java编程主题,可能包括但不限于: 1. **基础语法**:如变量、数据类型、运算符、控制流(if-else、循环、switch)、方法和类的定义。 2. **面向对象编程**:深入讲解封装、继承、多态等概念,以及如何设计和实现面向对象的程序。 3. **异常处理**:讨论了Java的异常体系,如何抛出、捕获和处理异常。 4. **集合框架**:详细介绍了ArrayList、LinkedList、HashSet、HashMap等集合类的使用和实现原理。 5. **泛型**:解释了泛型的引入及其在类和接口中的应用,以及泛型的边界和通配符。 6. **输入/输出流**:涵盖文件操作、序列化、网络流等。 7. **多线程**:讲述了线程的创建、同步、通信及并发编程的最佳实践。 8. **反射**:介绍如何在运行时检查和修改类的信息,包括构造函数、方法和字段。 9. **枚举和注解**:详细讲解Java中的枚举类型和注解的用法。 10. **Java库和API**:可能涵盖了Java标准库中的各种类和接口,如IO、NIO、GUI、网络编程等。 这本书不仅适合初学者,也对有经验的开发者具有很高的参考价值,因为它能够帮助读者深入理解Java的底层机制和最佳实践。通过阅读和实践书中的例子,读者可以全面提升自己的Java编程技能。

Write java code: Copy the files, small_weapons.txt, and large_weapons.txt from the assignment folder on Blackboard and save them to your folder. For testing purposes, you should use the small file. Use the large file when you think the application works correctly. To see what is in the files use a text editor. Nilesh is currently enjoying the action RPG game Torchlight 2 which is an awesome game and totally blows Auction House Simulator 3, oh sorry, that should be Diablo 3, out of the water. He has got a file containing info on some of the unique weapons in the game. The transaction file contains the following information: Weapon Name (string) Weapon Type (string) Damage (int) Weapon Speed (double) … To tell if one weapon is better than another you need to know the Damage Per Second (DPS) the weapon does, since weapons have a different attack speed. DPS is calculated by taking the damage value and dividing it by the attack speed.a) You will write a program that will allow Nilesh to load the file and display the weapon info and DPS of every weapon in the input file. When the user chooses to open a weapon file, they are required to type in the filename. It will then read the 4 values about a particular weapon and then display the 4 values to the console window on one line neatly padded along with the DPS of the weapon. This is repeated until the end of the file. b) Modify your code from a) so that the weapon information written to the console window is also written to a text file. The user should be able to specify the name of the file. Add a header to the beginning of the file which has column headers for each column. At the end of the text file display the total number of weapons in the file. c) Document your code appropriately and add your name and id number as comments at the top of your code. Please also submit this text file you have created. Enter the file you want to search end with .txt: large_weapons.txt 1 Blackfang Bludgeon Great Hammer 489 1.44 339.58333333333337 2 Bones 2 Boneshredder Great Axe 256 0.84 304.76190476190476 3 Comet's Tail Great Sword 872 1.2 726.6666666666667 4 Decapitator Great Sword 188 1.08 174.07407407407408 5 Demolisher Great Hammer 887 1.32 671.9696969696969

2023-05-27 上传