1.
public class test18 { /* public static void main(String[] args) { Zi z1=new Zi(); Zi z2=new Zi("zhangsan",15); } } class Fu{ String name; int age; public Fu(){} public Fu(String name,int age){ this.name=name; this.age=age; } } class Zi extends Fu{ public Zi(String zhangsan, int i) { } public Zi() { }*/ public static void main(String[] args) { Zi z = new Zi(); //System.out.println(Long.toHexString(VM.current().address0f(z))); Scanner sc = new Scanner(System.in); sc.next(); } } class Fu{ private int a=0x111; int b=0x222; public void fuShow1(){ System.out.println("public---FuShow"); } private void fuShow2(){ System.out.println("private---FuShow"); } } class Zi extends Fu{ int c=0x333; public void ziShow(){ System.out.println("public---ZiShow"); } }
2.
/*int main()
{
int a = 10;
int*pa=&a;
int**ppa=&pa;//int*是指pa的类型,int*后面的*是指ppa是一个指针变量。可以这样写的原因就是pa本身就是一个变量
**ppa = 20;
//*pa= 20;
//printf("%d\n", a);
return 0;
}*/
//二级指针变量是用来存放一级指针变量的地址
/*int main()
{
int a = 10;
int b = 20;
int c = 30;
int* parr[10] = { &a,&b,&c };
int i = 0;
for (i = 0;i < 3;i++)
{
printf("%d\n", *(parr[i]));//对指针数组的遍历
}
return 0;
}*/
//指针数组模拟二维数组
/*int main()
{
int i = 0;
int j = 0;
int arr[3][4] = { 1,2,3,4,2,3,4,5,3,4,5,6 };
for (i = 0;i < 3;i++)
{
for (j = 0;j < 4;j++)
{
printf("%d ", arr[i][j]);
}
printf("\n");
}
return 0;
}*/
int main()
{
int arr1[4] = { 1,2,3,4 };
int arr2[4] = {2,3,4,5 };
int arr3[4] = { 3,4,5,6};
int*parr[3] = { arr1,arr2,arr3 };
int i = 0;
int j = 0;
for (i = 0;i < 3;i++)
{
for (j = 0;j < 4;j++)
{
printf("%d ", parr[i][j]);
}
printf("\n");
}
}