aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Dan's Exam - Return Types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Dan Watch "Dan New topic
Author

Dan's Exam - Return Types

Vijay Albuquerque
Ranch Hand

Joined: Feb 17, 2002
Posts: 42
The following question appears in Dan's Exam on Return Types:

The compiler ignores the semi-colon's after the method declaration statements. I cannot figure out why it ignores this !!!


Vijay Albuquerque
SCJP 1.4, SCWCD 1.3
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Originally posted by Vijay Albuquerque:
The compiler ignores the semi-colon's after the method declaration statements. I cannot figure out why it ignores this !!!

The compiler doesn't really ignore the semi-colon. That's a perfectly legal statement in Java. Try the following program:

You'll find that the program compiles and executes fine. A semi-colon by itself is simply an empty statement.
Corey


SCJP Tipline, etc.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Originally posted by Corey McGlone:
You'll find that the program compiles and executes fine. A semi-colon by itself is simply an empty statement.

Ok... so everything our dear Corey said BEFORE this statement was perfectly correct... and if by "the program" he means the lil tid bit of code that he plopped in his post -- he's right -- it will compile... but the code that Vijay posted will NOT compile -- not because of the stray ;'s (like Corey said -- those are legal) but because of some errors with return types.
Ya know -- those bartender-types think they're so smart... sometimes ya just gotta show 'em that they're wrong.

Corey McGlone is still my hero.
[ January 02, 2003: Message edited by: Jessica Sant ]

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Dan Chisholm
Ranch Hand

Joined: Jul 02, 2002
Posts: 1865
Vijay,
The question is really about the return types. The semicolons are just typo errors.
The semicolons are viewed as empty statements and have no impact on the program. Even so, I'll remove them.


Dan Chisholm<br />SCJP 1.4<br /> <br /><a href="http://www.danchisholm.net/" target="_blank" rel="nofollow">Try my mock exam.</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dan's Exam - Return Types