• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Top level clases

 
Milind Deodhar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Class2 {
static class Class3 {
}
}

public class Class1{
public static void main (String args[]) {
// Class3 c = new Class2.Class3();
}
}
What is the correct way of defining a top level nested class
For a non inner Class3, it can do like
Class2.Class3 c = new Class2().new Class3();
but what should be the syntax for top level nested class
 
umang bhartia
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can access the toplevel nested class by calling

class2.class3 c = new class2.class3();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic