精通Java:Thinking in Java深度解析

需积分: 0 0 下载量 60 浏览量 更新于2024-07-30 收藏 2.02MB PDF 举报
"Think in Java" 《Think in Java》是一本由Bruce Eckel撰写的经典Java编程书籍,适合从零开始学习Java的初学者以及有一定经验的程序员。这本书以其深入浅出的讲解方式著称,作者以其丰富的编程经验和深厚的理论基础,帮助读者理解和掌握Java这门强大的面向对象编程语言。 本书涵盖了Java语言的基础语法到高级特性,包括但不限于: 1. **Java基础**:介绍Java的基本语法,如变量、数据类型、控制流语句、函数等,这些都是编程的基石。 2. **面向对象编程**:深入讲解面向对象的基本理论,如封装、继承、多态等概念,并通过实例帮助读者理解这些抽象概念。 3. **类与对象**:详细讨论如何定义和使用类,以及对象的创建和销毁,包括构造函数、析构函数、访问修饰符等。 4. **集合框架**:涵盖Java的集合体系,如ArrayList、LinkedList、HashSet、HashMap等,以及新加入的Java 1.2集合框架。 5. **Swing GUI**:讲解如何使用Swing库构建用户界面,包括组件、布局管理器、事件处理等。 6. **网络编程**:介绍Java在网络编程方面的支持,如Socket编程,客户端/服务器模型等。 7. **多线程**:详细阐述Java的多线程处理,包括线程同步、线程通信等复杂问题。 8. **虚拟机性能**:讨论Java虚拟机(JVM)的工作原理,以及优化Java代码的策略。 9. **与其他代码交互**:介绍Java如何通过JNI(Java Native Interface)与其他非Java代码(如C/C++)进行交互。 书中包含320个有用的Java程序实例,总计超过15000行代码,这些实践示例旨在帮助读者巩固理论知识,提高编程技能。此外,Bruce Eckel还在他的网站(http://www.BruceEckel.com)上提供了完整的书本正文、更新内容和程序代码,读者可以免费获取,并且还有配套的CD,包含15小时以上的合成语音授课。 读者反馈普遍积极,称赞其为“最好的Java参考书”、“最明智的购买选择”和“最棒的编程指南”。作为C++标准协会的有表决权成员,Bruce Eckel在面向对象编程领域有着广泛的影响,他的另一本书《Thinking in C++》也获得了高度赞誉。 通过阅读《Think in 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 上传