# Printing all PVector coordinates stored in an ArrayList

**URL:** <https://discourse.processing.org/t/printing-all-pvector-coordinates-stored-in-an-arraylist/25485>\
**Category:** Beginners\
**Created:** [November 17, 2020, 1:18pm UTC](https://discourse.processing.org/t/printing-all-pvector-coordinates-stored-in-an-arraylist/25485 "2020-11-17T13:18:44Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 17, 2020, 5:05pm UTC](https://discourse.processing.org/t/printing-all-pvector-coordinates-stored-in-an-arraylist/25485/6 "2020-11-17T17:05:56Z")

</div>

> [@papaboo](#):
>
> Just returns the index numbers like **sketch$Points@39a69ce2**

> [@Print class variables](https://discourse.processing.org/t/print-class-variables/8142/2):
>
> A class needs to [@Override](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Override.html) the [toString()](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#toString()) method, so it can return a String w/ the current value of its fields. coffee Here’s a link w/ an example for it: link[Forum.Processing.org/two/discussion/25986/how-can-i-replace-pvector-tostring#Item\_7](http://Forum.Processing.org/two/discussion/25986/how-can-i-replace-pvector-tostring#Item_7)

Other examples w/ **toString()**: 🤓

> [@How to reference an object in another function to its class?](https://discourse.processing.org/t/how-to-reference-an-object-in-another-function-to-its-class/17964/2):
>
> 1 way to do it: angel Person squid; void setup() { frameRate(1); squid = new Person(); } void draw() { squid.increaseAge(); // alt.: ++squid.age; print(squid); } class Person { int age; Person increaseAge() { ++age; return this; } String toString() { return "Age: " + age + TAB; } }

> [@Objects in objects](https://discourse.processing.org/t/objects-in-objects/22486/2):
>
> In general an object shouldn’t need to be aware of any other object which “owns” it. But if you feel you need such feature you can create an “owner” field for it: /\*\* \* AppleTree (v1.0.0) \* GoToLoop (2020/Jul/08) \* https://Discourse.Processing.org/t/objects-in-objects/22486/2 \*/ import java.util.List; Tree tree; void setup() { tree = new Tree().bearFruit().bearFruit(); println(tree); println(tree.apples); exit(); } class Apple { Tree owner; Apple() { } Apple(final Tr…

> [@Accessing functions from Java Generics](https://discourse.processing.org/t/accessing-functions-from-java-generics/3391/9):
>
> Even If we had 2 or more classes w/ the exactly same code, Java would still “see” them as different from each: void setup() { MyVec vec1 = new MyVec(); MyVecTwin vec2 = new MyVecTwin(); println(MyVec.class.isInstance(vec1)); // true println(MyVec.class.isInstance(vec2)); // false exit(); } class MyVec { float x = random(-100, 100), y = random(-100, 100), z; @Override String toString() { return "[" + x + ", " + y + ", " + z + "]"; } } class MyVecTwin { // exactly same…

> [@Parent function not using overwritten array from child](https://discourse.processing.org/t/parent-function-not-using-overwritten-array-from-child/22796/3):
>
> You’re not overriding but overshadowing the parent’s class field named array inside each of its child classes! Overriding is for non-static methods only. Other types of class members become overshadowed instead. So when subclassing take extra care not to accidentally re-declare inherited fields and static methods. If you need so instead assign a value w/o re-declaring them. // https://Discourse.Processing.org/t/ // parent-function-not-using-overwritten-array-from-child/22796/3 // GoToLoop …

---

_[View the full topic](https://discourse.processing.org/t/printing-all-pvector-coordinates-stored-in-an-arraylist/25485)._
