Results 1 to 2 of 2
  1. #1
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default NoSuchMethodException tho the method is public and spelled correctly, why?

    Hi,
    I'm trying to copy an instance of a class using reflection.
    In my class Poly I try to find a method for each inaccesible field in the class.
    For example, I have a variable:
    float outerRadius
    but its default, so to access it i added get and set methods:
    getOuterRadius() and setOuterRadius(float value)

    My program tries to find the get method like this:
    Poly.getClass().getDeclaredMethod("getOuterRadius" , null);
    but then it throws NoSuchMethodException and I have no idea why!
    The method is public and all so it shouldn't be a problem.
    Using getMethod(... Does not work either.

    So what is this problem all about?

  2. #2
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default Re: NoSuchMethodException tho the method is public and spelled correctly, why?

    Nvm, found out its suppose to get an array of classes rather than just one class in the getdecleard method thing

Similar Threads

  1. Correctly passing an element to a method
    By aianta in forum New To Java
    Replies: 5
    Last Post: 10-28-2011, 07:52 PM
  2. How to correctly overide hashcode method in Java
    By javin.paul in forum Reviews / Advertising
    Replies: 0
    Last Post: 10-08-2011, 08:57 AM
  3. drawString() method not working correctly
    By tnixon22 in forum New To Java
    Replies: 2
    Last Post: 02-25-2011, 08:57 PM
  4. My rotate 2d pos method isnt working correctly..
    By Addez in forum New To Java
    Replies: 5
    Last Post: 12-01-2009, 09:04 AM
  5. public method
    By dirtycash in forum New To Java
    Replies: 4
    Last Post: 11-21-2007, 07:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •