2

I have the following class definition:

public class kdtrees{
 ...
  public static class DataPoints{
  ... 
  }

}

I can create objects of the inner class using:

kdtrees.DataPoint point = new kdtrees.DataPoint();

I want to make point, an ArrayList so that I can instantiate multiple objects of the inner class. How can I do it?

3
  • You want to make an ArrayList of DataPoint objects? Commented Dec 29, 2012 at 21:45
  • 2
    Its the exact same with a nested class as it is with any other. ArrayList<DataPoints> list; or ArrayList<kdtrees.DataPoints> list; Commented Dec 29, 2012 at 21:45
  • 2
    Besides kdtrees should be called KdTrees. Commented Dec 29, 2012 at 21:48

2 Answers 2

4
List<kdtrees.DataPoint> list = new ArrayList<kdtrees.DataPoint>();
list.add(new kdtrees.DataPoint());
Sign up to request clarification or add additional context in comments.

1 Comment

can you please tell me, how to get object of inner class while retrieving the list
1
List<kdtrees.DataPoint> list = new ArrayList<kdtrees.DataPoint>();
points.add(new kdtrees.DataPoint());

Don't understand your problem, sorry.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.