• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Two questions from Java rule roundup

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First Java rule roundup question: Is this statement true or false: Inner class can access all members of outer class

Java rule roundup says 'Yes'

I say no because static inner class cannot access non-static members of outer class

-----------------------
Second Java rule roundup question: All exceptions inherit from ____ ?

Java rule roundup says Throwable

I say Exception because all RuntimeException and checked exceptions are subtypes of Exception
[ August 17, 2007: Message edited by: Sachin Kapoor ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"An inner class is a nested class that is not explicitly or implicitly declared static." Ref: JLS - 8.1.3 Inner Classes and Enclosing Instances.

Does Exception inherit from Exception?
 
Sachin Kapoor
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by marc weber:
"An inner class is a nested class that is not explicitly or implicitly declared static." Ref: JLS - 8.1.3 Inner Classes and Enclosing Instances.

Does Exception inherit from Exception?



Then it's ok. K&B define static class (including method-local class declared in static method) to be inner class, so that got me confused.
 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic