• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

bout top-level class

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends,
Declaration of Top-level class Frog are legal, assuming animal is a existing class
A. protected class Frog extends Animal{}
B. private class Frog extends Animal{}
C. transient clas Frog extends Animal{}
D. native class Frog extends Animal{}
as per my knowledge Top-level class must be either public or default. so that way none of above is correct answer but when i try to compile this code with protected and private modifier their class file created. so what should be the answer ?
thanx in advance
jay...
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I get a compile time exception "Syntax Error" when i try to make top level class protected or private.
 
jay vyas
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Randall Twede:
I get a compile time exception "Syntax Error" when i try to make top level class protected or private.


thanx Randall,
but if u have noticed then there will be class file created for protected and private modifier
 
Randall Twede
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i have heard of this before. it creates the class file even when the compiler throws an exception.
 
reply
    Bookmark Topic Watch Topic
  • New Topic