Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FizzSwitch and camelCase?

 
M Marsden
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sierra/Bates book says it mostly follows camelCase rules and that the SCJP exam will - I was somewhat confused by the sample question in chapter 3 (it's already been posted on these boards, so I'll omit the code). The question defines a class named Fizz containing a static method named FizzSwitch. It was my understanding the method should start lowercase?
 
Theodore Casser
Ranch Hand
Posts: 1902
Hibernate Netbeans IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't concentrate so much on that - mostly still allows for a 'slip' now and again. While most methods you'll see written in Java are going to start with a lower-case letter (camel-case), the compiler will accept upper-case letters at the start of methods. It's entirely legal.
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't remember exactly what we were going for with that question, but I can say that sometimes you'll find the code in the real exam questions that doesn't follow normal conventions. The fact is that normal conventions help make code more readable, and sometimes when we write exam questions we don't want to give certain clues to what's going on in the code.

So again, I'm not sure if that was what was going on with this question, but I can say that you might see stuff like this on the real exam.

hth,

Bert
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic