Two Laptop Bag*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "should we include { " Watch "should we include { " New topic
Author

should we include {

Roll
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
Wanderer
Sheriff

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
Wanderer
Sheriff

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
Cherry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: should we include {
 
Similar Threads
[JavaMail]: How to hide sender's email address?
clarify this pls
Is-Like-A and Is-A
Entity Bean in Class Diagram
classes syntax