Sams Teach Yourself Java™ in 24 Hours, Sixth Edition

Book description

Sams Teach Yourself Java in 24 Hours, Sixth Edition
Covering Java 7 and Android Development

In just 24 lessons of one hour or less, you can learn how to create Java applications. Using a straightforward, step-by-step approach, popular author Rogers Cadenhead helps you master the skills and technology you need to create desktop and web programs, web services, and even an Android app in Java.


Full-color figures and clear step-by-step instructions visually show you how to program with Java.


Quizzes and Exercises at the end of each chapter help you test your knowledge.


Notes, Tips, and Cautions provide related information, advice, and warnings.


Learn how to

  • Set up your Java programming environment

  • Write your first working program in just minutes

  • Control program decisions and behavior

  • Store and work with information

  • Build straightforward user interfaces

  • Create interactive web programs

  • Use threading to build more responsive programs

  • Read and write files and XML data

  • Master best practices for object-oriented programming

  • Create flexible, interoperable web services with JAX-WS

  • Use Java to create an Android app

  • PART I: Getting Started
    HOUR 1: Becoming a Programmer
    HOUR 2: Writing Your First Program
    HOUR 3: Vacationing in Java
    HOUR 4: Understanding How Java Programs Work

    PART II: Learning the Basics of Programming
    HOUR 5: Storing and Changing Information in a Program
    HOUR 6: Using Strings to Communicate
    HOUR 7: Using Conditional Tests to Make Decisions
    HOUR 8: Repeating an Action with Loops

    PART III: Working with Information in New Ways

    HOUR 9: Storing Information with Arrays
    HOUR 10: Creating Your First Object
    HOUR 11: Describing What Your Object Is Like
    HOUR 12: Making the Most of Existing Objects

    PART IV: Programming a Graphical User Interface
    HOUR 13: Building a Simple User Interface
    HOUR 14: Laying Out a User Interface
    HOUR 15: Responding to User Input
    HOUR 16: Building a Complex User Interface

    PART V: Moving into Advanced Topics
    HOUR 17: Creating Interactive Web Programs
    HOUR 18: Handling Errors in a Program
    HOUR 19: Creating a Threaded Program
    HOUR 20: Reading and Writing Files

    PART VI: Writing Internet Applications

    HOUR 21: Reading and Writing XML Data
    HOUR 22: Creating Web Services with JAX-WS
    HOUR 23: Creating Java2D Graphics
    HOUR 24: Writing Android Apps

    PART VII: Appendixes
    APPENDIX A: Using the NetBeans Integrated Development Environment
    APPENDIX B: Where to Go from Here: Java Resources
    APPENDIX C: This Book’s Website
    APPENDIX D: Setting Up an Android Development Environment

    Table of contents

    1. Title Page
    2. Copyright Page
    3. Contents at a Glance
    4. Table of Contents
    5. About the Author
    6. Dedication
    7. Acknowledgments
    8. Reader Acknowledgments
    9. We Want to Hear from You!
    10. Reader Services
    11. Introduction
    12. Part I: Getting Started
      1. Hour 1. Becoming a Programmer
        1. Choosing a Language
        2. Telling the Computer What to Do
        3. How Programs Work
        4. When Programs Don’t Work
        5. Choosing a Java Programming Tool
        6. Installing a Java Development Tool
      2. Hour 2. Writing Your First Program
        1. What You Need to Write Programs
        2. Creating the Saluton Program
        3. Beginning the Program
        4. Storing Information in a Variable
        5. Saving the Finished Product
        6. Compiling the Program into a Class File
        7. Fixing Errors
        8. Running a Java Program
      3. Hour 3. Vacationing in Java
        1. First Stop: Oracle
        2. Going to School with Java
        3. Lunch in JavaWorld
        4. Watching the Skies at NASA
        5. Getting Down to Business
        6. Stopping by Java Boutique for Directions
        7. Running Java on Your Phone
      4. Hour 4. Understanding How Java Programs Work
        1. Creating an Application
        2. Sending Arguments to Applications
        3. Creating an Applet
    13. Part II: Learning the Basics of Programming
      1. Hour 5. Storing and Changing Information in a Program
        1. Statements and Expressions
        2. Assigning Variable Types
        3. Naming Your Variables
        4. Storing Information in Variables
        5. All About Operators
        6. Using Expressions
      2. Hour 6. Using Strings to Communicate
        1. Storing Text in Strings
        2. Displaying Strings in Programs
        3. Using Special Characters in Strings
        4. Pasting Strings Together
        5. Using Other Variables with Strings
        6. Advanced String Handling
        7. Presenting Credits
      3. Hour 7. Using Conditional Tests to Make Decisions
        1. if Statements
        2. if-else Statements
        3. switch Statements
        4. The Conditional Operator
        5. Watching the Clock
      4. Hour 8. Repeating an Action with Loops
        1. for Loops
        2. while Loops
        3. do-while Loops
        4. Exiting a Loop
        5. Naming a Loop
        6. Testing Your Computer Speed
    14. Part III: Working with Information in New Ways
      1. Hour 9. Storing Information with Arrays
        1. Creating Arrays
        2. Using Arrays
        3. Multidimensional Arrays
        4. Sorting an Array
        5. Counting Characters in Strings
      2. Hour 10. Creating Your First Object
        1. How Object-Oriented Programming Works
        2. Objects in Action
        3. What Objects Are
        4. Understanding Inheritance
        5. Building an Inheritance Hierarchy
        6. Converting Objects and Simple Variables
        7. Creating an Object
      3. Hour 11. Describing What Your Object Is Like
        1. Creating Variables
        2. Creating Class Variables
        3. Creating Behavior with Methods
        4. Putting One Class Inside Another
        5. Using the this Keyword
        6. Using Class Methods and Variables
      4. Hour 12. Making the Most of Existing Objects
        1. The Power of Inheritance
        2. Establishing Inheritance
        3. Working with Existing Objects
        4. Storing Objects of the Same Class in Vectors
        5. Creating a Subclass
    15. Part IV: Programming a Graphical User Interface
      1. Hour 13. Building a Simple User Interface
        1. Swing and the Abstract Windowing Toolkit
        2. Using Components
        3. Creating Your Own Component
      2. Hour 14. Laying Out a User Interface
        1. Using Layout Managers
        2. Laying Out an Application
      3. Hour 15. Responding to User Input
        1. Getting Your Programs to Listen
        2. Setting Up Components to Be Heard
        3. Handling User Events
        4. Completing a Graphical Application
      4. Hour 16. Building a Complex User Interface
        1. Scroll Panes
        2. Sliders
        3. Change Listeners
        4. Using Image Icons and Toolbars
    16. Part V: Moving into Advanced Topics
      1. Hour 17. Creating Interactive Web Programs
        1. Standard Applet Methods
        2. Putting an Applet on a Web Page
        3. Creating an Applet
        4. Sending Parameters from a Web Page
        5. Handling Parameters in an Applet
        6. Using the Object Tag
      2. Hour 18. Handling Errors in a Program
        1. Exceptions
        2. Throwing Exceptions
        3. Throwing and Catching Exceptions
      3. Hour 19. Creating a Threaded Program
        1. Threads
        2. Working with Threads
        3. Starting with init()
        4. Catching Errors as You Set Up URLs
        5. Handling Screen Updates in the paint() Method
        6. Starting the Thread
        7. Handling Mouse Clicks
        8. Displaying Revolving Links
      4. Hour 20. Reading and Writing Files
        1. Streams
        2. Writing Data to a Stream
        3. Reading and Writing Configuration Properties
    17. Part VI: Writing Internet Applications
      1. Hour 21. Reading and Writing XML Data
        1. Creating an XML File
        2. Reading an XML File
        3. Reading RSS Syndication Feeds
      2. Hour 22. Creating Web Services with JAX-WS
        1. Defining a Service Endpoint Interface
        2. Creating a Service Implementation Bean
        3. Publishing the Web Service
        4. Using Web Service Definition Language Files
        5. Creating a Web Service Client
      3. Hour 23. Creating Java2D Graphics
        1. Using the Font Class
        2. Using the Color Class
        3. Creating Custom Colors
        4. Drawing Lines and Shapes
        5. Baking a Pie Graph
      4. Hour 24. Writing Android Apps
        1. Introduction to Android
        2. Creating an Android App
        3. Running the App
        4. Designing a Real App
    18. Part VII: Appendixes
      1. Appendix A. Using the NetBeans Integrated Development Environment
        1. Installing NetBeans
        2. Creating a New Project
        3. Creating a New Java Class
        4. Running the Application
        5. Fixing Errors
      2. Appendix B. Where to Go from Here: Java Resources
        1. Other Books to Consider
        2. Oracle’s Official Java Site
        3. Other Java Websites
        4. Job Opportunities
      3. Appendix C. This Book’s Website
      4. Appendix D. Setting Up an Android Development Environment
        1. Getting Started
        2. Installing Eclipse
        3. Installing Android SDK
        4. Installing the Android Plug-in for Eclipse
        5. Setting Up Your Phone
    19. Index

    Product information

    • Title: Sams Teach Yourself Java™ in 24 Hours, Sixth Edition
    • Author(s): Rogers Cadenhead
    • Release date: October 2011
    • Publisher(s): Sams
    • ISBN: 9780132841702