标签:ack 基础 sys 数据 port 对象 lis name main
package com.test.testfan; public class testfan_01_01_数组 { /** * @param args */ public static void main(String[] args) { // TODO 自动生成的方法存根 int[] a = new int[]{33, 33,3, 44}; System.out.println(a[0]); System.out.println(a.length); System.out.println(a[a.length-1]);//获取最后位数据 /*for (int i = 0; i < a.length; i++) { int j = a[i]; System.out.println(j); }*/ int[] b = new int[100]; b[0] = 1; b[1] = 1; b[2] = 1; b[3] = 1; b[4] = 1; System.out.println(b.length); } }
package com.test.testfan; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class testfan_01_02_集合 { public static void main(String[] args) { // TODO 自动生成的方法存根 List<String> list = new ArrayList<String>(); list.add("200"); String valueString = list.get(0); System.out.println(valueString); System.out.println(list.size());//类属性 //System.out.println(list.);//类属性 //通过数组 for (int i = 0; i < args.length; i++) { String string = args[i]; } List<Integer> list2 = new ArrayList<Integer>(); list2.add(200); int value2 = list2.get(0); for (int i = 0; i < args.length; i++) { String string = args[i]; System.out.println(string); } //通过集合 for (Iterator iterator = list2.iterator(); iterator.hasNext();) { Integer integer = (Integer) iterator.next(); System.out.println(integer); } //通过数组 for (int i = 0; i < args.length; i++) { } //通过迭代器 for (Integer integer : list2) { System.out.println(integer); } } }
package com.test.testfan; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class testfan_01_02_集合 { public static void main(String[] args) { // TODO 自动生成的方法存根 List<String> list = new ArrayList<String>(); list.add("200"); String valueString = list.get(0); System.out.println(valueString); System.out.println(list.size());//类属性 //System.out.println(list.);//类属性 //通过数组 for (int i = 0; i < args.length; i++) { String string = args[i]; } List<Integer> list2 = new ArrayList<Integer>(); list2.add(200); int value2 = list2.get(0); for (int i = 0; i < args.length; i++) { String string = args[i]; System.out.println(string); } //通过集合 for (Iterator iterator = list2.iterator(); iterator.hasNext();) { Integer integer = (Integer) iterator.next(); System.out.println(integer); } //通过数组 for (int i = 0; i < args.length; i++) { } //通过迭代器 for (Integer integer : list2) { System.out.println(integer); } // 数组属性使用 List<Integer> list3 = new ArrayList<Integer>(); if(!list3.isEmpty()) { int list4 = list3.get(0); System.out.println(list4); } list3.add(200); } }
package com.test.testfan; public class Person { public String name; public int age; private double money=1000; public String sex; public double getMoney() { return money; } public void setMoney(double money) { this.money = money; } }
package com.test.testfan; public class testfan_01_03_对象 { public static void main(String[] args) { // TODO 自动生成的方法存根 Person p1 = new Person(); Person p2 = new Person(); p1.name = "zhangsan"; p1.setMoney(60000.00); System.out.println(p1.name); System.out.println(p1.getMoney()); System.out.println(p1); System.out.println("-------------"); p2.name = "zhangsan9999"; p2.setMoney(90000.00); System.out.println(p2.name); System.out.println(p2.getMoney()); System.out.println(p2); } }
标签:ack 基础 sys 数据 port 对象 lis name main
原文地址:https://www.cnblogs.com/wujianbo123/p/10962938.html