Forums Register Login

help me in this code: inner classes

+Pie Number of slices to send: Send

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
1
+Pie Number of slices to send: Send
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.
Climb the rope! CLIMB THE ROPE! You too tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 955 times.
Similar Threads
Inner Class inside a method
"static class Inner construction"question required
innerclasses
Static Inner Class
Is an interface inside class implicitly static?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:01:18.