O'Reilly logo

Java Programming for Android Developers For Dummies, 2nd Edition by Barry A. Burd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 15

Ten Ways to Avoid Mistakes

IN THIS CHAPTER

check Checking your capitalization and value comparisons

check Watching out for fall-through

check Putting methods, listeners, and constructors where they belong

check Using static and nonstatic references

check Avoiding other heinous errors

“The only people who never make mistakes are the people who never do anything at all.” One of my college professors said that. I don’t remember the professor’s name, so I can’t give him proper credit. I guess that’s my mistake.

Putting Capital Letters Where They Belong

Java is a case-sensitive language, so you really have to mind your ps and qs — along with every other letter of the alphabet. Here are some concepts to keep in mind as you create Java programs:

  • Java’s keywords are all completely lowercase. For instance, in a Java if statement, the word if can’t be If or IF.
  • When you use names from Android's Application Programming Interface (API), the case of the names has to match what appears in the API.
  • The names ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required