• 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

should we include {

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 { ?
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops. You're right of course. I was only thinking about the {, silly me. Thanks.
 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic