/*
- 变量的赋值
- 变量是基本数据类型时:此时赋值的是变量所保存的数据值
- 变量是引用数据类型时:此时赋值的是变量所保存的数据的地址值
- 方法中参数的传递机制
- 方法必须由其所在类或对象调用才有意义。若方法含有参数:
- 实参:方法调用时实际传递给形参的参数值
- 形参:方法声明时的参数
- Java中方法的参数传递方式只有一种:值传递。将实际参数值的副本传入方法内,而参数本身不受影响。
- 形参是基本数据类型时:将实参的基本数据类型的数据值传递给形参
- 形参是引用数据类型时:将实参的引用数据类型变量的地址值传递给形参
*/
package com.atguigu.contact;
import java.util.*;
public class Object6 {public static void main(String[] args) {Scanner scan &#61; new Scanner(System.in);int a &#61; 23;int b &#61; a;b &#61; 11;System.out.println("a&#61;" &#43; a &#43; ",b&#61;" &#43; b);Arguments argu &#61; new Arguments();argu.num &#61; 33;Arguments argu1 &#61; argu;System.out.println(argu.num &#43; " " &#43; argu1.num);argu1.num &#61; 22;System.out.println(argu.num &#43; " " &#43; argu1.num);int m &#61; 11;int n &#61; 22;System.out.println("m &#61; " &#43; m &#43; ",n &#61; " &#43; n);argu.exchange(m, n);System.out.println("m &#61; " &#43; m &#43; ",n &#61; " &#43; n);Date d &#61; new Date();d.m &#61; 11;d.n &#61; 22;System.out.println("m &#61; " &#43; d.m &#43; ",n &#61; " &#43; d.n);argu.swap(d);System.out.println("m &#61; " &#43; d.m &#43; ",n &#61; " &#43; d.n);Date d1 &#61; new Date();d1.m &#61; 11;d1.n &#61; 22;System.out.println("m &#61; " &#43; d1.m &#43; ",n &#61; " &#43; d1.n);argu.swap1(d1);System.out.println("m &#61; " &#43; d1.m &#43; ",n &#61; " &#43; d1.n);Object6 o &#61; new Object6();o.frist();int[] arr &#61; new int[] {11,23,45,6,78,7,90,12,11};System.out.println(Arrays.toString(arr));for (int i &#61; 0; i < arr.length; i&#43;&#43;) {arr[i] &#61; arr[i] / arr[0];}System.out.println(Arrays.toString(arr));int[] arr1 &#61; new int[] {11,23,45,6,78,7,90,12,11};for (int i &#61; arr1.length - 1; i >&#61; 0; i--) {arr1[i] &#61; arr1[i] / arr1[0];}System.out.println(Arrays.toString(arr1));int[] arr2 &#61; new int[] {11,23,45,6,78,7,90,12,11};int temp &#61; arr2[0];for (int i &#61; 0; i < arr2.length; i&#43;&#43;) {arr2[i] &#61; arr2[i] / temp;}System.out.println(Arrays.toString(arr2));int[] array &#61; new int[] {1,2,3};System.out.println(array);char[] array1 &#61; new char[] {&#39;a&#39;,&#39;b&#39;,&#39;c&#39;};System.out.println(array1);CircleA c &#61; new CircleA();c.radius &#61; 4.5;System.out.println(c.findArea());ErgodicCircleA circle &#61; new ErgodicCircleA();circle.printAreas(c, 10);int i &#61; 10;int j &#61; 20;method(i,j);System.out.println("i &#61; " &#43; i);System.out.println("j &#61; " &#43; j);}public static void method(int i,int j) {i &#61; i * 10;j &#61; j * 10;System.out.println("i &#61; " &#43; i);System.out.println("j &#61; " &#43; j);System.exit(0);}
public void frist() {int m &#61; 7;Date d &#61; new Date();d.m &#61; 11;second(d,m);System.out.println(d.m &#43; ", " &#43; m);}public void second(Date d,int m) {m &#61; 9;d.m &#61; 17;Date da &#61; new Date();d &#61; da;System.out.println(d.m &#43; ", " &#43; m);}}
class Arguments{int num;public int setValue(int i) {return i;}public void exchange(int m,int n) {int temp;temp &#61; m;m &#61; n;n &#61; temp;}public void swap(Date date) {int temp;temp &#61; date.m;date.m &#61; date.n;date.n &#61; temp;}public void swap1(Date date) {date &#61; new Date();int temp;temp &#61; date.m;date.m &#61; date.n;date.n &#61; temp;}}
class Date{int m ;int n ;
}
class CircleA{double radius;public double findArea() {return radius * radius * Math.PI;}
}
class ErgodicCircleA{public void printAreas(CircleA c,int i) {System.out.println("Radius\t\tArea");for (int j &#61; 1; j <&#61; i; j&#43;&#43;) {c.radius &#61; j;System.out.println(c.radius &#43; "\t\t" &#43; c.findArea());}}
}