Learn Java for Android Development (Paperback)

Jeff Friesen



Android development is hot, and many programmers are interested in joining the fun. However, because this technology is based on Java, you should first obtain a solid grasp of the Java language and its foundational APIs to improve your chances of succeeding as an Android app developer. After all, you will be busy learning the architecture of an Android app, the various Android-specific APIs, and Android-specific tools. If you do not already know Java fundamentals, you will probably end up with a massive headache from also having to quickly cram those fundamentals into your knowledge base.  

Learn Java for Android Development
teaches programmers of any skill level the essential Java language and foundational Java API skills that must be learned to improve the programmer’s chances of succeeding as an Android app developer. Each of the book’s 10 chapters provides an exercise section that gives you the opportunity to reinforce your understanding of the chapter’s material. Answers to the book’s more than 300 exercises are provided in an appendix.

Once you complete this book, you will be ready to dive into Android, and you can start that journey by obtaining a copy of Beginning Android 2.  

What you’ll learn

  • The Java language: This book provides complete coverage of nearly every pre-Java version 7 language feature (native methods are briefly mentioned but not formally covered). Starting with those features related to classes and objects, you progress to object-oriented features related to inheritance, polymorphism, and interfaces. You then explore the advanced language features for nested types, packages, static imports, exceptions, assertions, annotations, generics, and enums. Continuing, you investigate strictfp, class literals, synchronized, volatile, the enhanced for loop statement, autoboxing/unboxing, and transient fields. The book also briefly presents most (if not all) of Java version 7’s language features, although not much is said about closures or modules (which were not finalized at the time of writing).
  • Java APIs: In addition to Object and APIs related to exceptions, you explore Math, StrictMath, BigDecimal, BigInteger, Package, Boolean, Character, Byte, Short, Integer, Long, Float, Double, Number, the References API, the Reflection API, String, StringBuffer, System, the Threading API, the collections framework, the concurrency utilities, the internationalization APIs, the Preferences API, Random, the Regular Expressions API, File, RandomAccessFile, stream classes, and writer/reader classes. You will also get a tiny taste of Swing in the context of internationalization.
  • Tools: You will learn how to use the JDK’s javac (compiler), java (application launcher), javadoc (Java documentation generator), and jar (Java archive creator, updater, and extractor) tools. You will also receive an introduction to the NetBeans and Eclipse integrated development environments. Although you can develop Android apps without NetBeans or Eclipse, working with these IDEs is much more pleasant.

Who this book is for

This book is for any programmer (including existing Java programmers and Objective-C [iPhone/iPad] programmers) of any skill level who needs to obtain a solid understanding of the Java language and foundational Java APIs before jumping into Android app development.

Table of Contents

  1. Getting Started with Java
  2. Learning Language Fundamentals
  3. Learning Object-Oriented Language Features
  4. Mastering Advanced Language Features, Part 1
  5. Mastering Advanced Language Features, Part 2
  6. Exploring the Basic APIs, Part 1
  7. Exploring the Basic APIs, Part 2
  8. Discovering the Collections Framework
  9. Discovering Additional Utility APIs
  10. Performing I/O
  11. Solutions to Exercises



《學習Java開發Android應用程式》這本書教授程式設計師必須學習的基礎Java語言和基礎Java API技能,無論你的技能水平如何。書中的每個章節都提供了練習部分,讓你有機會加強對該章節內容的理解。書中超過300個練習的答案附在附錄中。

完成這本書後,你將準備好開始學習Android,你可以通過獲得《開始學習Android 2》的副本來開始這個旅程。

- Java語言:本書完整介紹了幾乎所有Java 7之前的語言特性(簡要提及了本機方法,但沒有正式涵蓋)。從與類和物件相關的特性開始,進一步探討了與繼承、多態和介面相關的面向對象特性。然後,你將探索用於嵌套類型、封裝、靜態導入、異常、斷言、註釋、泛型和枚舉的高級語言特性。接著,你將研究strictfp、類文字、同步、易失性、增強的for循環語句、自動裝箱/拆箱和瞬態字段。本書還簡要介紹了Java 7的大多數(如果不是全部)語言特性,雖然對於閉包或模塊(在撰寫時尚未完成)沒有多少說法。
- Java API:除了Object和與異常相關的API之外,你還將探索Math、StrictMath、BigDecimal、BigInteger、Package、Boolean、Character、Byte、Short、Integer、Long、Float、Double、Number、References API、Reflection API、String、StringBuffer、System、Threading API、集合框架、並發工具、國際化API、首選API、Random、正則表達式API、File、RandomAccessFile、流類和寫入/讀取類。你還將在國際化的背景下稍微體驗Swing。
- 工具:你將學習如何使用JDK的javac(編譯器)、java(應用程式啟動器)、javadoc(Java文檔生成器)和jar(Java存檔創建器、更新器和提取器)工具。你還將介紹NetBeans和Eclipse集成開發環境。雖然你可以在沒有NetBeans或Eclipse的情況下開發Android應用程式,但使用這些IDE會更加愉快。

這本書適合任何程式設計師(包括現有的Java程式設計師和Objective-C [iPhone/iPad]程式設計師),無論技能水平如何,都需要在進入Android應用程式開發之前對Java語言和基礎Java API有扎實的理解。

1. 開始學習Java
2. 學習語言基礎
3. 學習面向對象的語言特性
4. 掌握高級語言特性,第一部分
5. 掌握高級語言特性,第二部分
6. 探索基本API,第一部分
7. 探索基本API,第二部分
8. 發現集合框架
9. 發現其他實用API
10. 高效使用Java API