• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inner classes

 
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi buddies,

when i try to access an inner class that is outside an outer class(within the same package),i get a java.lang.NoSuchMethodError error

now all i know is that this error is thrown at run time when a particular class no longer stores the defination for that method....

how can i fix this problem...plzzz help
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sorry, there isn't enough detail... please provide an example that generates the error that you are describing.

Henry
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sumedha rao wrote:Hi buddies,

when i try to access an inner class that is outside an outer class(within the same package),i get a java.lang.NoSuchMethodError error

now all i know is that this error is thrown at run time when a particular class no longer stores the defination for that method....

how can i fix this problem...plzzz help



Yeah please provide an example. And a class declared outside an external class but within the same package is no longer called an Inner class.
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohamed Sanaulla wrote:
Yeah please provide an example. And a class declared outside an external class but within the same package is no longer called an Inner class.



The inner class may be in another outer class. He/She is trying to access the inner class which is located in another Outer class from another Top level class.
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abimaran Kugathasan wrote:
The inner class may be in another outer class. He/She is trying to access the inner class which is located in another Outer class from another Top level class.



If that is the case, then the answer would depend on the access modifier for the inner class declaration. And regardless, it doesn't explain any java.lang.NoSuchMethodError error. There is someone missing from the question.

Henry
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:

Abimaran Kugathasan wrote:
The inner class may be in another outer class. He/She is trying to access the inner class which is located in another Outer class from another Top level class.



If that is the case, then the answer would depend on the access modifier for the inner class declaration. And regardless, it doesn't explain any java.lang.NoSuchMethodError error. There is someone missing from the question.

Henry



May be Sir, I just give a details about the possibilities, and waiting for his/her reply.
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey guys sorry for delay in posting the code

the problem was solved....and the error occured all because of one stupid silly blunder dumb mistake.....I FORGOT TO DECLARE public static void main(String args[])......



output: 7

Thanks...
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Abimaran Kugathasan wrote:
He/She is trying to access the inner class which is located in another Outer class from another Top level class.



My name makes it quite clear that i am a girl......
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sumedha rao wrote:

Abimaran Kugathasan wrote:
He/She is trying to access the inner class which is located in another Outer class from another Top level class.



My name makes it quite clear that i am a girl......


That's why most people preferred "OP" (Original Poster) to avoid confusions
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Next time please post the code along with the Stacktrace
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sumedha rao wrote:My name makes it quite clear that i am a girl......


Not necessarily. Names vary very much in every country and even in regions within a country. Its easy to confuse a person's gender if you are not familiar with the name. This might be a sort of hijack but I felt your reply was not very nice in this instance so I though I should point it out...
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ankit Garg wrote:

sumedha rao wrote:My name makes it quite clear that i am a girl......


Not necessarily. Names vary very much in every country and even in regions within a country. Its easy to confuse a person's gender if you are not familiar with the name. This might be a sort of hijack but I felt your reply was not very nice in this instance so I though I should point it out...



ok im sorry(if i should be so),and i dont think it will be taken serious by abimaran(because i myself dint take the comment seriously...lol........)

But i am a girl...remember it for next time.. (i wish i could announce it to the entire java ranch forum)

 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now i dont want anyone else commenting on my gender.....please lock this post
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sumedha rao wrote:now i dont want anyone else commenting on my gender.....please lock this post



Let's keep this topic open, in case someone wants to do a followup post to the original topic question. The mods can stop another detour (or spin off a side topic) of the subject of names and gender if it comes up again.

Henry
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sumedha rao wrote:
ok im sorry(if i should be so),and i dont think it will be taken serious by abimaran(because i myself dint take the comment seriously...lol........)

But i am a girl...remember it for next time.. (i wish i could announce it to the entire java ranch forum)



I didn't take it seriously, that's fine. Go ahead and clear your doubt here.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic