• Post Reply Bookmark Topic Watch Topic
  • New Topic

calling..nested class  RSS feed

 
Purujit Saha
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to call a static nested class outside the enclosing class.
Suppose,
====================
Class A
{
static class N
{
public void m1(){}
}
}
==================
Class B
{
}
================
My question how to call method m1() from class B ??

Thnx in Advance.........
[ November 15, 2005: Message edited by: Purujit Saha ]
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try out the different possibilities??
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that the m1 method needs to be static but I'm not sure.

This code works

 
Purujit Saha
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A nested class can declear static as well as non-static members inside its body.
My question how to call them from a outer class.
 
Stuart Ash
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by P.W Mathias Nilsson:
I think that the m1 method needs to be static but I'm not sure.

This code works



This should work too?
 
Purujit Saha
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnx Stuart
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!