سلام
داشتم آموزش جاوا رو میدیم (New Booston) که عنوان فیلم toString بود ، این کدهاش :
public class MyObject {
private int a;
private int b;
private int c;
public MyObject(int aa, int bb, int cc) {
a = aa;
b = bb;
c = cc;
System.out.printf("The constractur for this is %s\n", this);
}
public String toString() {
return String.format("%d/%d/%d", a, b, c);
}
}
public class Main {
public static void main(String[] args) {
MyObject myObject = new MyObject(1, 2, 3);
}
}
خروجی : The constractur for this is 1/2/3
حالا مشکلم اینه که نمیتونم درک کنم در متد سازنده کلاس MyObject وقتی خروجی رو چاپ میکنه با نوشتن this چجوری متد toString اونجا اجرا میشه؟
پیشاپیش ممنونم ،برای تاپیکهم عنوان بهتر از این نتونستم سرهم کنم.