Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830
this week in the
Programmer Certification
forum!
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
Tim Cooke
Liutauras Vilda
Jeanne Boyarsky
paul wheaton
Sheriffs:
Ron McLeod
Devaka Cooray
Henry Wong
Saloon Keepers:
Tim Holloway
Stephan van Hulst
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Frits Walraven
Forum:
Programmer Certification (OCPJP)
Inner classes
Ferwed Kondos
Greenhorn
Posts: 6
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Inner classes cannot have static members of any kind? true or false
John Stone
Ranch Hand
Posts: 332
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
true - if we consider declaration only
false - if we consider also inheritance (static member can be inherited)
Thayarupan Raj
Greenhorn
Posts: 13
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
But We can have static members in "Static Inner class" if enclosing class does not have any static/final member
public class Tests {
public static void main(
String
args[])
{
}
static class inner
{
static int s=10;
public static void rt()
{
}
}
}
[ September 30, 2007: Message edited by: John Kristin ]
[ September 30, 2007: Message edited by: John Kristin ]
Ankith suresh
Ranch Hand
Posts: 42
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi john
But We can have static members in "Static Inner class"
"if enclosing class does not have any static/final member" ???
What does
"if enclosing class does not have any static/final member" ???
meant???
John Stone
Ranch Hand
Posts: 332
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
from Sun tutorial:
Terminology: Nested classes are divided into two categories: static and non-static. Nested classes that are declared static are simply called static nested classes. Non-static nested classes are called inner classes.
So, when I talked about inner classes, I always meant non-static nested-classes.
Fire me boy! Cool, soothing, shameless self promotion:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Native Method
Why final keyword is accepted with private?
Most Difficult Part?
Re:inner classes
What is a class file with $ symbol in the name
More...