メイン (アプレット) クラス内で作成したオブジェクトから、メイン (アプレット) クラスのオブジェクトにアクセスする方法を誰かに教えてもらえないかと思っていました。ソースは物事を少し明確にするかもしれません。通常はアクセサーを使用しますが、これは単純化のためです
public class Bravo {
int copyint;
Bravo() {
// Here I want to access the targetobj's theint from here
copyint = targetobj.theint; // I belive this doesn't work
}
}
public class Charlie {
static int theint;
Charlie() {
theint = 7;
}
}
public class alpha extends JApplet {
public void init() {
createApp();
}
public void createApp() {
Charlie targetobj = new Charlie();
Bravo askingobj = new Bravo();
}
}
TYIA - ローランド