摘要: 1.数组的简单介绍:概念:同一种类型数据的集合,其实数组就是一个容器;数组的好处:可以自动给数组中的元素从0开始编号,方便操作这些元素;格式1:元素类型[] 数组名 = new 元素类型[元素个数或者数组长度];示例:int[] arr = new int[5];格式2:元素类型[] 数组名 = n... 阅读全文
posted @ 2013-04-03 14:41 馨云 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1.函数的定义:函数就是定义在类中的具有特定功能的一段独立的小程序;函数也称为方法;2.函数的格式实例和讲解:class FunctionDemo{ public static void main(String[] args) { int c = add(3,4); System.out.print... 阅读全文
posted @ 2013-04-03 14:39 馨云 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 1.讲解:break语句:应用范围:选择结构和循环结构;continue语句:应用于循环结构;注:a.这两个语句离开应用范围,存在是没有意义的;b.这个两个语句单独存在下面都不可以有语句,因为执行不到;c.continue语句是结束本次循环继续下次循环;d.符号的出现,可以让这两个语句作用于指定的范... 阅读全文
posted @ 2013-04-01 11:56 馨云 阅读(117) 评论(0) 推荐(0) 编辑
摘要: class ForForTest{ public static void main(String[] args) { /*用for循环做出以下图: * * * * * * * * * * * * * * * */ for(int x=1; x 0; i--) { x ... 阅读全文
posted @ 2013-03-30 17:11 馨云 阅读(141) 评论(0) 推荐(0) 编辑
摘要: class ForFor99{ public static void main(String[] args) { /* 九九乘法表: 1*1=1 1*2=2 2*2=4 1*3=1 2*3=6 3*3=9 ...... */ for(int x=1; x<=9; x++) { for(i... 阅读全文
posted @ 2013-03-29 17:04 馨云 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 1.for循环嵌套讲解:class ForForDemo{ public static void main(String[] args) { //大圈套小圈思想: /* for(int x=0; x0; x--) { for(int y=1; yx;y--) { S... 阅读全文
posted @ 2013-03-29 15:26 馨云 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 1.循环结构:for讲解class ForDemo{ public static void main(String[] args) { /* for(初始化表达式;循环条件表达式;循环后的操作表达式) { 执行语句;(循环体) } */ for(int x = 1; x2; a++,... 阅读全文
posted @ 2013-03-28 16:48 馨云 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 1.while练习_累加思想:class WhileTest{ public static void main(String[] args) { /* 练习: 获取1到10 10个数字的和; 0 + 1 1 + 2 3 + 3 6 + 4 10 + 5 思路: 1.每次参与加法的数值不确定; 2.每... 阅读全文
posted @ 2013-03-27 17:55 馨云 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 1.循环结构:代表语句:while,do while,for;I.while循环:class WhileDemo{ public static void main(String[] args) { /* while(条件表达式) { 执行语句; } */ int x = 1; wh... 阅读全文
posted @ 2013-03-27 10:01 馨云 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1.switch语句讲解:class SwitchDemo{ public static void main(String[] args) { /*switch语句格式: switch(表达式)//byte,short,int,char四种类型供选择; { case 取值1: 执行语... 阅读全文
posted @ 2013-03-26 15:59 馨云 阅读(306) 评论(0) 推荐(0) 编辑