Sams Teach Yourself Java in 24 Hours (Covering Java 7 and Android)

  • ISBN13:


  • ISBN10:


  • Edition: 6th
  • Format: Paperback
  • Copyright: 2011-10-21
  • Publisher: Sams Publishing
  • View Upgraded Edition
  • Purchase Benefits
  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $34.99 Save up to $1.40
  • eBook
    Add to Cart


Supplemental Materials

What is included with this book?

  • The eBook copy of this book is not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.


In arenas ranging from enterprise development to Android app programming, Java remains one of the world's most popular programming languages. Sams Teach Yourself Java in 24 Hourshelps Java beginners gain true mastery over the new Java 7. In this book's straightforward, step-by-step approach, each lesson builds on everything that's come before, helping you learn Java's core features and techniques from the ground up. Friendly, accessible, and conversational, this book offers a practical grounding in the language, without ever becoming overwhelming or intimidating. This new edition adds coverage of Java 7 and Android. This coverage includes a new chapter on writing Android apps, as well as additional material on Android and Java 7 throughout the book. This edition's examples have been extensively refreshed and updated, with more visual examples and diagrams. And in addition to the new Android chapter, the book also includes an additional new chapter on creating Java 2D graphics with XRender. Coverage includes: learning programming basics; working with data and objects; programming graphical user interfaces; creating interactive web programs; handling errors; writing Internet and mobile apps; and much more.

Author Biography

Rogers Cadenhead is a writer, computer programmer, and web developer who has written more than 20 books on Internet-related topics, including Sams Teach Yourself Java in 21 Days. He maintains the Drudge Retort and other websites that receive more than 20 million visits a year. This book’s official website is at www.java24hours.com.

Table of Contents


PART I: Getting Started

HOUR 1: Becoming a Programmer

Choosing a Language     4

Telling the Computer What to Do     5

How Programs Work     7

When Programs Don’t Work     8

Choosing a Java Programming Tool     8

Installing a Java Development Tool     9

HOUR 2: Writing Your First Program

What You Need to Write Programs     13

Creating the Saluton Program     14

Beginning the Program     14

Storing Information in a Variable     17

Saving the Finished Product     18

Compiling the Program into a Class File     19

Fixing Errors     19

Running a Java Program     20

HOUR 3: Vacationing in Java

First Stop: Oracle     25

Going to School with Java     27

Lunch in JavaWorld     29

Watching the Skies at NASA     31

Getting Down to Business     32

Stopping by Java Boutique for Directions     33

Running Java on Your Phone     35

HOUR 4: Understanding How Java Programs Work

Creating an Application      39

Sending Arguments to Applications     41

Creating an Applet     42

PART II: Learning the Basics of Programming

HOUR 5: Storing and Changing Information in a Program

Statements and Expressions     49

Assigning Variable Types     50

Naming Your Variables     54

Storing Information in Variables     54

All About Operators     55

Using Expressions     59

HOUR 6: Using Strings to Communicate

Storing Text in Strings     65

Displaying Strings in Programs     66

Using Special Characters in Strings     67

Pasting Strings Together     68

Using Other Variables with Strings     68

Advanced String Handling     70

Presenting Credits     72

HOUR 7: Using Conditional Tests to Make Decisions

if Statements      79

if-else Statements     83

switch Statements     84

The Conditional Operator      86

Watching the Clock      87

HOUR 8: Repeating an Action with Loops

for Loops     95

while Loops     98

do-while Loops      99

Exiting a Loop      100

Naming a Loop     101

Testing Your Computer Speed      102

PART III: Working with Information in New Ways

HOUR 9: Storing Information with Arrays

Creating Arrays      108

Using Arrays     109

Multidimensional Arrays     111

Sorting an Array      111

Counting Characters in Strings      113

HOUR 10: Creating Your First Object

How Object-Oriented Programming Works      121

Objects in Action     122

What Objects Are      124

Understanding Inheritance      125

Building an Inheritance Hierarchy      125

Converting Objects and Simple Variables      127

Creating an Object      132

HOUR 11: Describing What Your Object Is Like

Creating Variables     137

Creating Class Variables      139

Creating Behavior with Methods      140

Putting One Class Inside Another      146

Using the this Keyword      147

Using Class Methods and Variables     148

HOUR 12: Making the Most of Existing Objects

The Power of Inheritance      155

Establishing Inheritance     157

Working with Existing Objects     159

Storing Objects of the Same Class in Vectors     160

Creating a Subclass     164

PART IV: Programming a Graphical User Interface

HOUR 13: Building a Simple User Interface

Swing and the Abstract Windowing Toolkit      169

Using Components      170

Creating Your Own Component      180

HOUR 14: Laying Out a User Interface

Using Layout Managers      187

Laying Out an Application     192

HOUR 15: Responding to User Input

Getting Your Programs to Listen     201

Setting Up Components to Be Heard     202

Handling User Events      202

Completing a Graphical Application      207

HOUR 16: Building a Complex User Interface

Scroll Panes     219

Sliders      222

Change Listeners      223

Using Image Icons and Toolbars      227

PART V: Moving into Advanced Topics

HOUR 17: Creating Interactive Web Programs

Standard Applet Methods     235

Putting an Applet on a Web Page      238

Creating an Applet     239

Sending Parameters from a Web Page      242

Handling Parameters in an Applet      243

Using the Object Tag      245

HOUR 18: Handling Errors in a Program

Exceptions     249

Throwing Exceptions      256

Throwing and Catching Exceptions     258

HOUR 19: Creating a Threaded Program

Threads     265

Working with Threads      270

Starting with init()      272

Catching Errors as You Set Up URLs     272

Handling Screen Updates in the paint() Method     273

Starting the Thread     274

Handling Mouse Clicks     276

Displaying Revolving Links     276

HOUR 20: Reading and Writing Files

Streams     283

Writing Data to a Stream     290

Reading and Writing Configuration Properties     292

PART VI: Writing Internet Applications

HOUR 21: Reading and Writing XML Data

Creating an XML File     299

Reading an XML File      302

Reading RSS Syndication Feeds     307

HOUR 22: Creating Web Services with JAX-WS

Defining a Service Endpoint Interface      313

Creating a Service Implementation Bean     316

Publishing the Web Service     317

Using Web Service Definition Language Files     318

Creating a Web Service Client     320

HOUR 23: Creating Java2D Graphics

Using the Font Class     327

Using the Color Class     328

Creating Custom Colors     329

Drawing Lines and Shapes     329

Baking a Pie Graph     333

HOUR 24: Writing Android Apps

Introduction to Android     343

Creating an Android App     345

Running the App     352

Designing a Real App     355

PART VII: Appendixes

APPENDIX A: Using the NetBeans Integrated Development Environment

Installing NetBeans     373

Creating a New Project     374

Creating a New Java Class     376

Running the Application      378

Fixing Errors     378

APPENDIX B: Where to Go from Here: Java Resources

Other Books to Consider      381

Oracle’s Official Java Site     382

Other Java Websites     383

Job Opportunities     385

APPENDIX C: This Book’s Website 387

APPENDIX D: Setting Up an Android Development Environment

Getting Started     389

Installing Eclipse     390

Installing Android SDK     390

Installing the Android Plug-in for Eclipse      391

Setting Up Your Phone     394



9780672335754    TOC    9/30/2011



Rewards Program

Write a Review