【自动化__持续集成】___java___List

一、代码如下

package www.wujianbotwo;

import java.util.*;

public class Demo07 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		List mylist= new List();

	}

}
package www.wujianbotwo;

import java.util.*;

public class Demo07 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//List mylist= new List();

		String[] names= {"woniuxy", "admin", "qiang"};
		Object name= "woniuxy";
		Object age= 40;
		Object  demo= new Demo07();

		Object[] objs= {"name", 50, 123.45, true, demo};

		//List mylist= new List();

		Demo07 demo07= (Demo07)new Object();

	}

}
package www.wujianbotwo;

import java.util.*;

public class Demo07 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		//List mylist= new List();

		String[] names= {"woniuxy", "admin", "qiang"};
		Object name= "woniuxy";
		Object age= 40;
		Object  demo= new Demo07();

		Object[] objs= {"name", 50, 123.45, true, demo};

		List<Object> mylist= new ArrayList<Object>();

		List<String> list= new ArrayList<String>();
		//Demo07 demo07= (Demo07)new Object();

		list.add("aaa");
		list.add("wujianbo");
		list.add("wudongmei");
		list.add("wujiamin");
		for(int i=0; i<list.size(); i++) {
			System.out.println(list.get(i));
		}

		list.remove("wujianbo");//删除字符串数组列表中的元素
		for(int i=0; i<list.size(); i++) {
			System.out.println(list.get(i));
		}

		list.remove(0);//删除字符串数组列表中的第1个元素
		for(int i=0; i<list.size(); i++) {
			System.out.println(list.get(i));
		}

		list.set(1, "wujianbo");//更改列表数组中的第1个元素
		for(int i=0; i<list.size(); i++) {
			System.out.println(list.get(i));
		}

		System.out.println(list.indexOf("wujianbo"));//输出列表数组中wujianbo元素所在数组中的下标

	}

}
时间: 2024-10-10 19:40:43

【自动化__持续集成】___java___List的相关文章

【自动化__持续集成】___java___文本文件__字节流

一.代码如下 package www.wujianbotwo; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; public class Demo09 { public static void main(String[] args) { // TODO

【自动化__持续集成】___java___字符串转数组

一.代码如下 package www.wujianbotwo; public class Demo08 { public static void main(String[] args) { // TODO Auto-generated method stub String content= "wujianbo,wujianob,33333"; String[] ud= content.split(",");//将字符串分段成一个数组 for(int i=0; i&l

【自动化__持续集成】___java___XMl___DOM读

一.代码如下 package com.wujianbo.five; import javax.sound.midi.Sequence; import javax.xml.bind.Element; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import

【自动化__持续集成】___java___重写

一.代码如下 package www.wujianbotwo; class Door { int height= 200; int weight= 80; String material= "实木"; private void open() { // TODO Auto-generated method stub System.out.println("开门"); } public void close() { // TODO Auto-generated meth

【自动化__持续集成】___java___继承

一.代码如下 package www.wujianbotwo; class Door { int height= 200; int weight= 80; String material= "实木"; public void open() { // TODO Auto-generated method stub System.out.println("开门"); } public void close() { // TODO Auto-generated metho

【自动化__持续集成】___java___excel__jxl改

一.代码如下 package com.wujianbo.five; import java.awt.HeadlessException; import java.awt.Label; import java.io.File; import java.io.IOException; import jxl.Workbook; import jxl.read.biff.BiffException; import jxl.write.WritableSheet; import jxl.write.Wri

【自动化__持续集成】___java___excel__jxl读

一.代码如下 package com.wujianbo.five; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.demo.Demo; import jxl.read.bif

【自动化__持续集成】___java___正则表达式

一.代码如下 package com.wujianbo.five; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Demo01 { public static void main(String[] args) { // TODO Auto-generated method stub String phone= "13541433525"; String phoneEx= &quo

【自动化__持续集成】___java___excel__jxl写

一.代码如下 package com.wujianbo.five; import java.io.File; import java.io.IOException; import org.apache.poi.ddf.EscherColorRef.SysIndexSource; import jxl.Workbook; import jxl.write.Label; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook