在java中,全局變量可以採用定義爲靜態成員的方法。
public class Select {
static int a[]=new int[1001];
public static void swap(int [] a,int x,int y)
{
int temp;
temp=a[x];
a[x]=a[y];
a[y]=temp;
}
}
數組a是一個全局變量。
在java中,全局變量可以採用定義爲靜態成員的方法。
public class Select {
static int a[]=new int[1001];
public static void swap(int [] a,int x,int y)
{
int temp;
temp=a[x];
a[x]=a[y];
a[y]=temp;
}
}
數組a是一個全局變量。