Arrays提供了一组操作array的静态方法。
一、基本类型数组打印
public static void printBaseArray(){
int[] ar = new int[10];
for (int i=0; i < ar.length; i++) {
ar[i] = (1000 - (300 + i));
}
System.out.println("打印基本类型数组:"+Arrays.toString(ar));
}
输出结果:
打印基本类型数组:[700, 699, 698, 697, 696, 695, 694, 693, 692, 691]
二、对象类型数组打印
public static void printObjectArray(){
Random random = new Random();
Cell[] cells = new Cell[10];
for(int i=0;i<10;i++){
cells[i] = new Cell(random.nextInt(50),random.nextInt(50));
}
System.out.println("打印对象类型数组:"+Arrays.toString(cells));
}
public class Cell {
private int x;
private int y;
public Cell(int x,int y){
this.x = x;
this.y = y;
}
public String toString(){
return "x="+x+",y="+y;
}
}
输出结果:
打印对象类型数组:[x=24,y=38, x=0,y=9, x=5,y=1, x=36,y=9, x=36,y=38, x=47,y=2, x=45,y=32, x=9,y=46, x=36,y=5, x=17,y=3]
分享到:
相关推荐
Antenna Arrays.pdf
Gain an in-depth understanding of PHP 7 arrays. After a quick overview of PHP 7, each chapter concentrates on single, multi-dimensional, associative, and object arrays. PHP Arrays is a first of its ...
/** *Arrays提供数组操作的一系列实用方法 *1输出 *2排序 *3二分查找 *4复制 *5扩容 */
NULL 博文链接:https://chaoyi.iteye.com/blog/2082720
radar antenna arrays, and smart antenna arrays for automatic cruise control applications provide increased safe travelling for vehicle passengers. Vehicle localization techniques based on the antenna ...
网络图片地址url集合arrays.xml文件
Microphone Arrays : A Tutorial
PHP Arrays Single Multi-dimensional Associative and Object Arrays in PHP 7 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn...
PHP Arrays Single, Multi-dimensional, Associative and Object Arrays in PHP 7 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如...
ite_Antenna_Arrays_and_FSS
利用电磁波的相干原理,通过计算机控制输往天线各阵元电流相位的变化来改变波束的方向,同样可进行扫描,称为电扫描。天线阵,根据扫描情况可分为相扫、频扫、相/相扫、相/频扫、机/相扫、机/频扫、有限扫等多种体制...
个人研究所得,包含对其内部jdk源码的分析。 同时会结合ArrayList中对该两个方法的调用做进一步说明。...总结一句话:在允许的情况下,尽量调用System.arraycopy方法,实在不行再调用Arrays.copyOf方法。
Constructing Compressed Suffix Arrays with Large Alphabets 生物信息论文
Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_Arrays.pdf Arduino项目开发 Control_Arrays_...
天线圣经-Finite Antenna Arrays and FSS
Light scattering by particle and hole arrays for electric magnetic
arrays的常用API
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). Java AC版本
This reference book introduces the reader to the cutting edge antenna array technology used in the automotive industry
麦克风阵列的语音信号处理算法方面的经典书籍,包含麦克风阵列的语音增强、声源定位、麦阵应用等方面的算法