- 博客(10)
- 收藏
- 关注
转载 java笔记,对数组的操作和私有工具类解释
/* 数组操作集合 */ class ArrayTool { private ArrayTool(){}//强制不能创建对象。私有化。这其实是个构造函数 public static int getMax(int[] arr) //最大值 { int max = 0; for(int i= 1;i<arr.length;i++) { if (arr[i]>...
2018-06-22 15:25:42 231
转载 java笔记,static修饰符
/*static静态修饰符的用法 是一个修饰符,用于修饰成员(成员函数,成员变量) 当成员被修饰后。就多用了一个调用方式,除了可以被对象调用。还可以直接被类名调用 如:类名.静态成员/方法 1 在一个(不是栈,和堆的)内存中中存放静态变量,随着类的加载而加载,随着类的死亡,而死亡,生命周期最长 2 优先于对象存在 3 被所有的对象所共享 4 可以被类名所调用 5 主函数是静态的 实列变量和类变...
2018-06-22 00:52:06 140
原创 java笔记 ,冒泡与选择排序及数组越界
class FunctionDemo { public static void main(String[] args) { int[] arrYs = {3,6,4,5,7,9}; for(int a =0;a<arrYs.length;a++){ System.out.print(arrYs[a]+"\t"); } maopaopaixu(arrYs); ...
2018-06-21 02:30:30 300
原创 java笔记06,
//对具体数值进行判断,且数量不多的时候用switch-- case class SwitchDemo { public static void main(String[] args) { int x = 6; //switch只能接收byte short int char switch(x){ case 3: System.out.println("Hello ...
2018-06-20 20:08:31 83
原创 java笔记05,数据简单操作
class OsDemo //数据操作 { public static void main(String[] args) { int a = 3 ,b; //定义了a变量为3,和没值变量b // b = a++; //a++ 》= a = a+1所以a值为4,先进行b= a ,后 a++ b= a ++; //System.out.println(a); //Syste...
2018-06-20 20:07:35 67
原创 java笔记04,if循环
// 1:根据用户定义的数值不同,打印对应的星期英文 // 2:指定月份,打印季节3,4,5春季 // 3 对于布尔值,和区间数判断用if——else,适用范围比switch更广 class IfTest { public static void main(String[] args) { int x = 4; if(x == 1) System.out.println("m...
2018-06-20 20:05:54 123
原创 java学习笔记03,for循环99乘法表
// 实现99乘法表 class ForTest { public static void main(String[] args) { for(int i=1;i<=9;i++){ for(int j=1;j<=i;j++){ System.out.print(j + "*" + i + "=" + j*i + "\t");// 转义字符\t增加一个缩进 ...
2018-06-20 20:05:03 73
原创 java学习笔记02,数据类型
class DemoMath // 数据类型演示, { public static void main(String[] args) { int x = 6; System.out.println(x); byte b = 2; //-128~127 -2^8 2^8 short s = 30000; //-32768 32767 long l = 4l; floa...
2018-06-20 20:03:46 103
原创 java学习笔记01,变量值交换
//变量值交换 class DemoBianLiang { public static void main(String[] args) { //通过第三方变量 int n = 3, m = 8; int temp; temp = n; n = m ; m = temp; //不用第三方 n = m+ n; //如果n和m的值非常大,容易超出int范围 ...
2018-06-20 20:01:41 103
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人