File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes should we include { Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "should we include { " Watch "should we include { " New topic

should we include {

Ranch Hand

Joined: Jan 20, 2000
Posts: 52
Which are valid declarations :
a. private class A
b. class X extends class Y { // Note the {
both a & b are valid. so when they mention class declaration should we include { ?
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
I would have to say that neither one is a valid declaration - but both can be part of a valid declaration. A valid class declaration would have to include { and }, unless something in the problem wording suggests that the declaration doesn't have to be complete. I have seen sample questions that ask "which can be part of a valid declaration?" - both (a) and (b) would then be valid.

"I'm not back." - Bill Harding, Twister
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
No Jim. the 2nd declaration
class X extends class Y {
is not valid even as 'part of a valid declaration. It has 'extends class Y' . It shd be 'class X extends Y'
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Oops. You're right of course. I was only thinking about the {, silly me. Thanks.
Cherry Mathew
Ranch Hand

Joined: Dec 26, 2000
Posts: 159
if u guys r talking about what to write in JCP exam what if they ask to write a method and what if that method take parameters
and what if the ask us to replace a statement do we have to put the semicolon also
I agree. Here's the link:
subject: should we include {
It's not a secret anymore!