[Java in NetBeans] Lesson 12. Arrays
这个课程的参考视频和图片来自youtube。
主要学到的知识点有:
1. Array: container that holds a fixed number of values of the same type, can be access by index.
- Create a string array and initialize the elements one by one. Index will be start from 0 to size -1.
String[] names = new String[3];
names[0] = "Tom";
names[1] = "Bob";
names[2] = "Joe";
// Below is a wrong comment
names[3] = "wrong!" // Will show error because out of the index.
- Automatic detect the size of the array
String[] names = new String[]{"Tom", "Bob", "Joe"};
2. Go through the elements in the array.
- for loop using index
for ( int i = 0; i < names.length; i ++){
System.out.printf("%s ", names[i]);
}
// the result will be like this
Tom, Bob, Joe
- for loop using "foreach"
for ( String each : names){
System.out.printf("%s ", each);
}
// the result will be like this
Tom, Bob, Joe
[Java in NetBeans] Lesson 12. Arrays的更多相关文章
- [Java in NetBeans] Lesson 13. Multidimensional Arrays
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Multidimensional Array: Array that has more than one dimension. ...
- [Java in NetBeans] Lesson 07. JavaDoc and Unit Tests
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. organize code into packages Create a package if want to make th ...
- [Java in NetBeans] Lesson 00. Getting Set-up for Learning Java
这个课程的参考视频在youtube. 主要学到的知识点有: set up needs Java SE JDK, NetBeans IDE class name should be the same l ...
- [Java in NetBeans] Lesson 17. File Input/Output.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...
- [Java in NetBeans] Lesson 16. Exceptions.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) ...
- [Java in NetBeans] Lesson 15. Sorting and Searching.
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Build in functions in java.util.Collections Need to implement a co ...
- [Java in NetBeans] Lesson 09. Switch / If-Else Ladder
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: 1. Nested If-else statement (if-else ladder) /** * 90 and above == ...
- [Java in NetBeans] Lesson 06. Custom classes
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Constructors: A special method called when an object of the class ...
- [Java in NetBeans] Lesson 05. Method/function
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Define a method:(motivation: write one time, but use it many times ...
随机推荐
- js删除Array数组中的某个元素
Array.prototype.indexOf = function (val) { ; i < this.length; i++) { if (this[i] == val) return i ...
- 文末有福利 | IT从业者应关注哪些技术热点?
7月14-15日,MPD工作坊北京站即将开幕,目前大会日程已经出炉,来自各大企业的技术专家,按照软件研发中心的岗位职能划分,从产品运营.团队管理.架构技术.自动化运维等领域进行干货分享,点击此[链接] ...
- [No0000168]Excle只允许用户输入纯文本,禁止用户修改单元格样式、格式等
背景:自己的模板给别人,让他填完信息上传到系统里,但别人经常不按模板的格式来填写,导致无法程序自动化.能不能在模板上把格式锁住,只允许输入纯文本,但不能改格式? 方法: 步骤一,创建你要的模板 其中, ...
- C和C指针小记(十)-函数
1.函数的定义 函数的定义就是函数体的实现. 语法: 类型 函数名(形式参数) 代码块 函数返回类型和函数名分开写是代码风格的问题,现代语言如swift返回值在函数名和参数表的后面,这样使得某些工程工 ...
- JS图片水印
attendanceClick(userID,headImg,userName,company,scoreNmu) { let base64Image = 'assets/imagesaring.pn ...
- [daily][nfs] nfs客户端设置
[daily] 主机间目录共享 1. 安装nfs工具,其实是mount需要mount.fs 否则会出现类似如下错误: [root@stds ~]# mount -t nfs 192.168.7.1:/ ...
- Java之旅_面向对象_封装
参考并摘自:http://www.runoob.com/java/java-encapsulation.html 在面向对象的程序设计方法中,封装(英语 :Encapsulation)是指一种将函数接 ...
- mysql之索引简介
索引分类 mysql在存储数据时,是按着主键的顺序存储的.主键索引是物理索引,其他索引都是逻辑索引. 普通索引 普通索引是最基本的索引,没有任何限制的索引,普通索引列的数据可以重复.其唯一的任务就是加 ...
- ActiveMQ介绍及安装
1. ActiveMQ 1.1. 什么是ActiveMQ ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范 ...
- 1-2-编译U-boot
1-2-编译U-boot 1.su+enter进入超级用户模式. 2.cd /mnt/+两次Tab去到根目录,ls显示共享文件夹里的文件. 3.解压tar xvfj uboot_TQ210_1.3.4 ...