close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 發問中 
java變數印不出來
Aug 3rd 2013, 09:08


package myJava;
public class ggg //
{
    public static void main(String args[])
    {
    CMyClass X[] = new CMyClass[5];
    for(int i=0;i<X.length;i++)
  X[i] = new CMyClass();
    COtherClass Obj = new COtherClass();
    Obj.show(X);
    }
}   

class COtherClass
{   
    public void show(CMyClass X[])
    {
    for(int i=0;i<X.length;i++)
  System.out.println("物件X[" + i + "]實體的位址在" + X[i]);
//這行加 入 System.out.println(" VarA =" +VarA);有錯誤訊息1如下
 

   }
}

class CMyClass
{
    public  int VarA;
//這行加入System.out.println(" VarA=" + VarA);錯誤訊息2 

    private int VarB;
}

//////////////////////////////////////////////
錯誤訊息1
error;cannot find symbol
 System.out.println("Var A="+VarA);
symbol: variable VarA
location: class COtherClass
1 error

錯誤訊息2
error; expected
System.out.println("Var A=" +VarA); 
........
..............

請高手說明為什麼???

小弟想要印出VarA變數及各陣列的VarA地址請問要怎麼寫?謝謝!

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers. Five Filters recommends: 'You Say What You Like, Because They Like What You Say' - http://www.medialens.org/index.php/alerts/alert-archive/alerts-2013/731-you-say-what-you-like-because-they-like-what-you-say.html

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 candycrushsaga4 的頭像
    candycrushsaga4

    看見台灣線上看, 看見台灣上映戲院, 看見台灣心得, 看見台灣紀錄片, 看見台灣dvd, 看見台灣原聲帶, 看見台灣下載

    candycrushsaga4 發表在 痞客邦 留言(0) 人氣()