• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

FizzSwitch and camelCase?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1902
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic