• Post Reply Bookmark Topic Watch Topic
  • New Topic

help me in this code: inner classes  RSS feed

 
naga santhosh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

while accessing inner class from instance area of outer class i get the following error:
javac outer1.java
outer1.java:18: error: cannot find symbol
o.m2();
^
  symbol:   method m2()
  location: variable o of type outer1
1 error

how can i resolve this ?
  --thanks in adavance
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, next time put code tags around your code block, not right in front of it. Also, don't forget to indent your code. I've fixed both for you this time, to make the code readable.

You call method m2 on an instance of class outer1 (which should start with a capital letter...), but the method is part of class inner (again, capital letter...). Move the method outside class inner so it's placed directly in class outer1, then it should work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!