Hi all,
This is another newbie question. Can you please explain what is a Reference Variable, and how to use it? For example, there is a reference variable called "Point origin" in the Rectangle Class.
public class Rectangle {
public int width = 0;
public int height = 0;
public Point origin;
public class Point {
public int x = 0;
public int y = 0;
public Point(int a, int b) {
x = a;
y = b;
}
}
Some confusions that I have ~ :
1. How does the 'Rectangle class' know 'where' does the reference variable "Point origin;" come from?
2. Does "Point" refer to a 'class' called Point or to its 'constructor'?
3. What if inside the 'Point class{}', there are many constructors and methods? For example, method "doThis()" and "doThat()", then we use the Dot operator to call the doThis and doThat method, right? For e.g:- origin.doThis(); origin.doThat, is it correct?
Sorry for asking very basic questions here. Hopefully, some other beginners would like to know the answers too. :-)
Thank you!