




已阅读5页,还剩72页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第五章 常用实体类,5.1 String类,Java使用java.lang包中的String 类来创建一个字符串变量. 1.字符串常量 如:”你好” “12.3456” “SCHOOL” 2.声明字符串 String s;,5.1 String类,3.创建字符串 使用String类的构造方法 例如:s=new String(“ we are students”); 也可以用一个已经创建的字符串去创建另一个字符串 如:String tom=String(s); 另外比较常用的构造方法: String (char a):用一个字符数组a创建一个字符串对象,如: Char a=b , o , y; String s=new String(a); String(char a ,int startIndex , int count):提取字符数组a中的一部分字符创建一个字符串对象,参数startIndex和count分别指定在a中提取字符的起始位置和从该位置开始截取的字符个数. 如:char a=s , t , b , u , s , n; String s=new String(a,2,3);,5.1 String类,4.引用字符串常量对象 字符串常量是对象,因此把字符串常量的引用赋值给一个字符串变量,则具有相同的实体. 如: String s1,s2; S1=“how are you”; S2=“how are you”;,0xAb28,0xAb28,How are you,5.1.5 String类的常用方法,1.public int length() 使用String 类的length()方法可以获取一个字符串的长度, 如: String s=“We are students”,tom=“我们是学生”; int n1,n2; n1=s.length(); n2=s.length();,5.1.5 String类的常用方法,2.public boolean equals(String s) 使用String 类的equals方法,比较当前字符串对象的实体是否与参数指定的字符串s的实体相同. 如: String tom=new String(“we are students”); String boy=new String(“We are students”); String jerry=new String(“we are students”); tom.equals(boy) 的值是false tom.equals(jerry)的值是true 字符串调用public boolean equalslgnoreCase(String s)比较当前字符串对象与参数指定的字符串s是否相同,比较时忽略大小写.,5.1.5 String类的常用方法,equals的用法 class Example5_1 public static void main(String args) String s1,s2; s1=new String(“we are students“); s2=new String(“we are students“); System.out.println(s1.equals(s2); /输出结果是:true。 System.out.println(s1=s2); /输出结果是:false String s3,s4; s3=“how are you“; s4=“how are you“; System.out.println(s3.equals(s4); /输出结果是:true。 System.out.println(s3=s4); /输出结果是:true。 ,5.1.5 String类的常用方法,3.public boolean startsWith(String s) 、 public boolean endsWith(String s) 方法 字符串对象调用startsWith(String s)方法,判断当前字符串对象的前缀是否是参数指定的字符串s. 如: String tom=“220302620629021”; String jerry=“21079670924022”; tom.startsWith(“220”) 的值是true; jerry.startsWith(“220”)的值是false. 使用endsWith(String s)方法,判断一个字符串的后缀是否是字符串s,如: tom.endsWith(“021”) 的值是true; jerry.startsWith(“021”)的值是false.,5.1.5 String类的常用方法,4.public boolean regionMatches(int firstStart,String other,int ortherStart,int length) 方法 字符串对象调用regionMatches(int firstStart,String other,int ortherStart,int length) 方法,从当前字符串参数firstStart指定的位置开始处,取长度为length的一个子串,并将这个子串和参数other指定的一个子串进行比较,其中,other指定的子串是从otherStart指定的位置开始,从other中取长度为length的一个子串。如果两个子串相同该方法就返回true,否则返回false 使用该方法的重载方法, public boolean regMatches (boolean b,int firstStart, String other , int otherStart ,int length) 可以通过参数b决定是否忽略大小写,当b取true时,忽略大小写。,5.1.5 String类的常用方法,/判断一个字符串中出现了几个en class Example5_2 public static void main(String args) int number=0; String s=“student;entropy;engage,english,client“; for(int k=0;ks.length();k+) if(s.regionMatches(k,“en“,0,2) number+; System.out.println(“number=“+number); ,5.1.5 String类的常用方法,5.public int compareTo(String s) 方法 字符串对象可以使用compareTo(String s) 方法,按照字典序与参数s指定的字符串比较大小。如果当前的字符串与s,相同,该方法返回值是0;如果当前字符串对象大于s,该方法返回正值;如果小于s, 该方法返回负值。 如: String str=“abcde”; SpareTo(“boy”)小于0;pareTo(“aba”)大于0;pareTo(“abcde”)等于0 按字典比较两个字符串还可以使用 public int compareTolgnoreCase(String s)方法,该方法忽略大小写,5.1.5 String类的常用方法,/字符串排序 class Example5_3 public static void main(String args) String a=“boy“,“apple“,“Applet“,“girl“,“Hat“; for(int i=0;ia.length-1;i+) for(int j=i+1;ja.length;j+) if(pareTo(ai)0) String temp=ai; ai=aj; aj=temp; for(int i=0;ia.length;i+) System.out.print(“ “+ai); ,5.1.5 String类的常用方法,6.public int indexOf(String s) 方法 字符串对象调用indexOf(String s) 方法,从当前字符串的头开始检索字符串s,并返回首次出现s的位置。如果没有检索到字符串s,该方法返回的值是-1。 字符串调用indexOf(String s,int startpoint)方法从当前字符串的startpoint位置处开始检索字符串s,并返回首次出现s的位置。如果没有检索到字符串s,该方法返回的值是-1。 字符串调用lastindexOf(String s)方法从当前字符串的头开始检索字符串s,并返回最后出现s的位置,如果没有检索到字符s,该方法返回的值是-1。 如: String tom=“I am a good cat”; tom.indexOf(“a”); /值是2 tom.indexOf(“good”,2); /值是7 tom.indexOf(“a”,7); /值是13 tom.indexOf(“w”,2); /值是-1,5.1.5 String类的常用方法,7.public String substring(int startpoint) 方法 字符串对象调用substring(int startpoint) 方法获得一个当前字符串的子串,该子串是从当前字符串的startpoint处截取到最后所得到的字符串,字符串对象调用substring(int start,int end)方法获得一个当前字符串的子串,该子串从当前字符串的start处截取到end处所得到的字符串,但不包括end处所对应的字符。 如: String tom=“I love tom”; String s=tom.substring(2,5); /s值是lov,5.1.5 String类的常用方法,8.public String replaceAll(String old,String new) 方法 字符串对象s调用该方法可以获得一个串对象,这个串对象是通过参数new指定的字符串替换s中的由old指定的所有字符串而得到的字符串。,5.1.5 String类的常用方法,9.public String trim() 方法 字符串s调用该方法可以得到一个字符串对象,该字符串是s去掉前后空格后的字符串。,5.1.6 字符串与基本数据类型的相互转化,java.lang包中的Integer类调用其方法: public static int parseInt(String s) 可以将“数字”格式的字符串转化为int型数据; 如: int x; String s=“3452”; x=Integet.parseInt(s);,5.1.6 字符串与基本数据类型的相互转化,java.lang包中的Byte、Short、Long、Float、Double类的数据类型转化方法: public static byte parseByte(String s) public static short parseShort(String s) public static long parseLong(String s) public static float parseFloat(String s) public static double parseDouble(String s),5.1.6 字符串与基本数据类型的相互转化,/从键盘输入若干个数,求平均值 public class Example5_4 public static void main(String args) double n,sum=0.0 ; for(int i=0;iargs.length;i+) sum=sum+Double.parseDouble(argsi); n=sum/args.length; System.out.println(“平均数:“+n); /*编译后,使用控制台输入数值 *java Example5_4 “20” “67.05” “12.66” “20.1” */,5.1.6 字符串与基本数据类型的相互转化,String 类方法将数值转化为字符串 public String valueOf(byte n) public String valueOf(int n) public String valueOf(long n) public String valueOf(float n) public String valueOf(double n) 如:String str=String.valueOf(123.5598); float x=123.562f; String temp=String.valueOf(x);,5.1.7 对象的字符串表示,所有类都默认是java.lang包中Object类的子类或间接子类。Object类有一个public方法toString(), 一个对象通过调用该方法可以获得该对象的字符串表示。,5.1.7 对象的字符串表示,例子5: import java.util.Date; import java.awt.*; public class Example5_5 public static void main(String args) Date date=new Date(); Button button=new Button(“确定“); System.out.println(date.toString(); System.out.println(button.toString(); ,5.1.8 字符串与字符、字节数组,1.字符串与字符数组: 用数组创建字符串对象,用String类的构造方法:String(char a) 和String(char a , int offset ,int length) String类也提供将字符串存放到数组中的方法: Public void getChars(int start, int end , char c ,int offset) 字符串调用getChars方法将当前字符串中的一部分字符复制到参数c指定的数组中,将字符串中从位置start到end-1位置上的字符复制到数组c中,并从数组c的offset处开始存放这些字符。注意必须保证c能容纳下要被复制的字符。,5.1.8 字符串与字符、字节数组,class Example5_6 public static void main(String args) char c,d; String s=”巴西足球队击败德国足球队”; c=new char2; s.getChars(5,7,c,0); System.out.println(c); d=new chars.length(); s.getChars(7,12,d,0); s.getChars(5,7,d,5); s.getChars(0,5,d,7); System.out.println(d); ,5.1.8 字符串与字符、字节数组,1.字符串与字符数组: String类还提供一个方法: public char toCharArray() 字符串对象调用该方法可以初始化一个字符串数组,该数组的长度与字符串的长度相等,并将字符串对象的全部字符复制到该数组中。,5.1.8 字符串与字符、字节数组,class Example5_7 public static void main(String args) String s=“列车时刻表“; char a=s.toCharArray(); for(int i=0;ia.length;i+) ai=(char)(ait); String secret=new String(a); System.out.println(“密文:“+secret); for(int i=0;ia.length;i+) ai=(char)(ait); String code=new String(a); System.out.println(“原文:“+code); ,5.1.8 字符串与字符、字节数组,2.字符串与字节数组: String类的构造方法String(byte)用指定的字节数组构造一个字符串对象。 String(byte, int offset ,int length)构造方法用指定的字节数组的一部分,即从数组起始位置offset开始取 length个字节构造一个字符串对象。 public byte getBytes()方法使用平台默认的字符编码,将当前字符串转化为一个字节数组。,5.1.8 字符串与字符、字节数组,public class Example5_8 public static void main(String args) byte d=“你我他“.getBytes(); System.out.println(“数组d的长度是(一个汉字占两个字节):“+d.length); String s=new String(d,0,2); System.out.println(s); ,5.2 StringBuffer类,String类创建的字符串对象是不可修改的,String对象一旦创建,那么实体是不可以再发生变化的。 如: String s=new String(“I love this game”);,0x12ABC,I love this game,不可以再发生变化,对象,实体,5.2 StringBuffer类,StringBuffer类创建的字符串对象可修改,该类对象的实体内存空间可以自动地改变大小,便于存放一个可变的字符串。如: StringBuffer s=new StringBuffer(“I love this game”); s.append(“ ok”);,0x12ABC,I love this game ok,可以再发生变化,对象,实体,5.2 StringBuffer类,1.StringBuffer类的构造方法: StringBuffer() StringBuffer(int size) StringBuffer(String s),5.2 StringBuffer类,1.StringBuffer类的构造方法: StringBuffer() 无参数的构造方法创建StringBuffer对象,分配给该对象的实体的初始容量可以容纳16个字符,当该对象的实体存放的字符序列长度大于16时候,实体自动增加。 StringBuffer对象可以通过length()方法获取实体中存放的字符序列长度,通过capacity()方法获取当前实体的实际容量。,5.2 StringBuffer类,1.StringBuffer类的构造方法: StringBuffer(int size) 用此构造方法创建一个StringBuffer对象,可指定分配给该对象的实体的初始容量为参数size指定的字符个数,当对象的实体存放的字符序列的长度大于size时,实体的容量自动增加。,5.2 StringBuffer类,1.StringBuffer类的构造方法: StringBuffer(String s) 用此构造方法创建一个StringBuffer对象,可以指定分配给该对象的实体的初始容量为参数字符串s的长度再加16个字符。,5.2 StringBuffer类,class Example5_9 public static void main(String args) StringBuffer str=new StringBuffer(); str.append(“大家好“); System.out.println(“str:“+str); System.out.println(“length:“+str.length(); System.out.println(“capacity:“+str.capacity(); str.append(“我们大家都很愿意学习Java语言“); System.out.println(“str:“+str); System.out.println(“length:“+str.length(); System.out.println(“capacity:“+str.capacity(); StringBuffer sb=new StringBuffer(“Hello“); System.out.println(“length:“+sb.length(); System.out.println(“capacity:“+sb.capacity(); ,5.2 StringBuffer类,2.StringBuffer类的常用方法: append方法 使用StringBuffer类的append方法可以将其他Java类型数据转化为字符串后,再追加到StringBuffer对象中。 StringBuffer append(String s):将一个字符串对象追加到当前StringBuffer对象中,并返回当前StringBuffer对象的引用。 StringBuffer append(int n):将一个int类型数据转化为字符串对象后再追加到当前StringBuffer对象中,并返回StringBuffer对象的引用。 StringBuffer append(Object o):将一个Object对象的字符串表示追加到当前的StringBuffer对象中,并返回当前StringBuffer对象的引用。 StringBuffer append(long n) StringBuffer append(boolean n) StringBuffer append(float n),5.2 StringBuffer类,2.StringBuffer类的常用方法: public char charAt(int n) 和 public void setCharAt(int n,char ch) char charAt(int n):得到参数n指定位置上的单个字符 setCharAt(int n,char ch):将当前StringBuffer对象实体中的字符串位置n处的字符用参数ch制定的字符替换。,5.2 StringBuffer类,2.StringBuffer类的常用方法: StringBuffer insert(int index,String str): insert方法将一个字符串插入到另一个字符串中,并返回当前对象的引用。 public StringBuffer reverse() 该方法将对象实体中的字符翻转,并返回当前对象的引用。 StringBuffer delete(int startIndex,int endIndex) 从当前StringBuffer对象实体的字符串中删除一个子字符串,并返回当前对象的应用。,5.2 StringBuffer类,2.StringBuffer类的常用方法: StringBuffer replace(int startIndex,int endIndex,String str) 该方法将当前StringBuffer对象实体中的字符串的一个字字符串用参数str指定的字符串替换。,5.2 StringBuffer类,例子10 class Example5_10 public static void main(String args) StringBuffer str=new StringBuffer(“我们大家都很愿意学习Java语言“); str.setCharAt(0 ,w); str.setCharAt(1 ,e); System.out.println(str); str.insert(2, “ all“); System.out.println(str); str.delete(6,8); System.out.println(str); int index=str.indexOf(“都“); str.replace(index,str.length(),“ love java“); System.out.println(str); ,5.3 StringTokenizer类,java.util包中的StringTokenizer类可以分析一个字符串并将字符串分解成可以被独立使用的单词。 两个构造方法: StringTokenizer(String s):为字符串s构造一个分析器,使用默认的分割符集合,即空格符、换行符、回车符、Tab符、进纸符等 StringTokenizer(String s,String delim):为字符串s构造一个分析器。参数dilim中的字符被作为分割符。,5.3 StringTokenizer类,nextToken()方法:可以逐个获取字符串中的单词。 hasMoreTokens()方法:字符串有语言符号,该方法返回true countTokens():得到字符串一共有多少个单词。,5.3 StringTokenizer类,例子11: import java.util.*; public class Example5_11 public static void main(String args) String s=“we are stud,ents“; StringTokenizer fenxi=new StringTokenizer(s,“ ,“); /空格和逗号做分 int number=fenxi.countTokens(); while(fenxi.hasMoreTokens() String str=fenxi.nextToken(); System.out.println(str); System.out.println(“还剩“+fenxi.countTokens()+“个单词“); System.out.println(“s共有单词:“+number+“个“); ,5.4 Character类,常用方法: public static boolean isDigit(char ch)如果ch是数字字符方法返回true public static boolean isLetter(char ch)如果ch 是字母方法返回true public static boolean isLowerCase(char ch)如果ch是小写字母方法返回true public static boolean isUpperCase(char ch)如果ch是大写字母方法返回true public static char toLowerCase(char ch)返回ch的小写形式 public static char toUpperCase(char ch)返回ch的大写形式 public static boolean isSpaceChar(char ch)如果ch是空格返回true,5.4 Character类,例子12: import java.util.*; public class Example5_12 public static void main(String args) String s=new String(“abcABC123“); System.out.println(s); char a=s.toCharArray(); for(int i=0;ia.length;i+) if(Character.isLowerCase(ai) ai=Character.toUpperCase(ai); else if(Character.isUpperCase(ai) ai=Character.toLowerCase(ai); s=new String(a); System.out.println(s); ,5.5 Date类,Date类在java.util包中。使用Date类的无参数构造方法创建的对象可以获取本地当前时间。 用Date的构造方法Date(long time)创建的Date对象表示相对1970年1月1日0点(GMT)的时间。 获取系统时间: System类的静态方法 public long currentTimeMills() 用此方法获取的时间是从1970年1月1日0点(GMT)到目前时刻所走过的毫秒数。 Date 对象表示时间的默认顺序是:星期、月、日、小时、分、秒、年,5.5 Date类,格式化日期: DateFormat的子类SimpleDateFormat实现日期的格式化,采用SimpleDateFormat的常用构造方法: public SimpleDateFormat(String pattern) 用该构造方法创建的对象调用format(Date date)方法格式化时间对象date。注:pattern中应当还有一些有效的字符序列,如下: y或yy 表示用2位数字输出年份;yyyy表示用4位数字输出年份 M或MM表示用2位数字或文本输出月份,如果想用汉字输出月份,pattern中应连续包含至少3个M,如:MMM。 d或dd 表示用2位数字输出日 H或HH 表示用2位数字输出小时 m或mm 表示用2位数字输出分 s或ss 表示用2位数字输出秒 E 表示用字符串输出星期,5.5 Date类,import java.util.Date; import java.text.SimpleDateFormat; class Example5_13 public static void main(String args) Date nowTime=new Date(); System.out.println(“现在的时间:“+nowTime); SimpleDateFormat matter1=new SimpleDateFormat(“yyyy年MM月dd日 北京时间“); System.out.println(“现在的时间:“+matter1.format(nowTime); SimpleDateFormat matter2= new SimpleDateFormat(“yyyy年MM月Edd日HH时mm分ss秒 北京时间“); System.out.println(“现在的时间:“+matter2.format(nowTime); SimpleDateFormat matter3= new SimpleDateFormat(“北京时间dd日HH时MMM ss秒mm分EE“); System.out.println(“现在的时间:“+matter3.format(nowTime); long time=-1800; Date date=new Date(time); System.out.println(“-1800秒表示的日期时间是:“+date); ,5.6 Calendar类,Calendar类在java.util包中。 使用Calendar类的static方法getInstance()可初始化一个日历对象。 如:Calendar calendar=Calendar.getInstance(); 可以调用以下方法,可以将日历翻到任何一个时间: public final void set (int year,int month, int date) public final void set(int year,int month , int date,int hour,int minute) public final void set(int year,int month,int date, int hour, int minute, int second) 当参数year取负数时候表示公元前。,5.6 Calendar类,调用方法public int get(int field)可以获得有关年份、月份、小时、星期等信息,参数field的有效值由Calendar的静态常量指定。 例如:calendar.get(Calendar.MONTH); 返回一个整数,如果整数是0表示当前是在一月,整数是1表示当前日历是在二月。 调用方法public int getTimeInMillis()可以将时间表示为毫秒。,5.6 Calendar类,import java.util.*; class Example5_14 public static void main(String args) Calendar calendar=Calendar.getInstance(); /创建一个日历对象。 calendar.setTime(new Date(); /用当前时间初始化日历时间。 String 年=String.valueOf(calendar.get(Calendar.YEAR), 月=String.valueOf(calendar.get(Calendar.MONTH)+1), 日=String.valueOf(calendar.get(Calendar.DAY_OF_MONTH), 星期=String.valueOf(calendar.get(Calendar.DAY_OF_WEEK)-1); int hour=calendar.get(Calendar.HOUR_OF_DAY), minute=calendar.get(Calendar.MINUTE), second=calendar.get(Calendar.SECOND); System.out.println(“现在的时间是:“); System.out.println(“+年+“年“+月+“月“+日+“日 “+ “星期“+星期); System.out.println(“+hour+“时“+minute+“分“+second+“秒“); calendar.set(1962,5,29); /将日历翻到1962年6月29日,注意5表示六月。 long time1962=calendar.getTimeInMillis(); calendar.set(2003,9,5); /将日历翻到2003年10月5日。9表示十月。 long time2003=calendar.getTimeInMillis(); long 相隔天数=(time2003-time1962)/(1000*60*60*24); System.out.println(“2003年10月5日和1962年6月29日相隔“+相隔天数+“天“); ,5.6 Calendar类,import java.util.*; class Example5_15 public static void main(String args) System.out.println(“ 日 一 二 三 四 五 六“); Calendar 日历=Calendar.getInstance(); 日历.set(2004,9,1); /将日历翻到2004年10月1日,注意0表示一月。 /获取1日是星期几(get方法返回的值是1表示星期日,星期六返回的值是7): int 星期几=日历.get(Calendar.DAY_OF_WEEK)-1; String a=new String星期几+31; /存放号码的一维数组 for(int i=0;i星期几;i+) ai=“*“; for(int i=星期几,n=1;i星期几+31;i+) if(n=9) ai=String.valueOf(n)+“ “; else ai=String.valueOf(n) ; n+; /打印数组: for(int i=0;ia.length;i+) if(i%7=0) System.out.println(“); /换行。 System.out.print(“ “+ai); ,5.7 Math类,Math类包含在Java.lang包中,它包含很多用来进行科学计算的类方法,这些方法可以直接通过类名调用。 Math类的两个静态常量,E 和PI, E=2.7182828284590452354 PI=3.14159265358979323846,5.7 Math类,Math类的常用方法: public staic long abs(double a) 返回a的绝对值 public staic double max(double a,double b) 返回a、b的最大值 public staic double min(double a,double b)返回a、b的最小值 public staic double random()产生一个01之间的随机数(不包括0和1) public staic double pow(double a,double b)返回a的b次幂 public staic double sqrt(double a)返回a的平方根 public staic double log(double a)返回a的对数 public staic double sin(double a)返回a的正弦值 public staic double asin(double a)返回a的反正弦值,5.7 Math类,NumberFormat类的方法 格式化显示数字 常用方法 public final String format(double number) public void setMaximunFractionDigits(int newValue) public void setMinimunFractionDigits(int newValue) public void setMaximumIntegerDigits(int newValue) public void setMinimumIntegerDigits(int newValue),5.7 Math类,例子16:,5.8 Vector类,java.util包中的Vector类负责创建一个向量对象。向量创建时,不用给出大小。向量大小自动增加。 创建方法: Vector a=new Vector(); 当把某一种类型的对象放入一个向量后,数据被默认为是Object对象。,5.8 Vector类,Vector类常用的方法: public void add(Object o)将对象o添加到向量的末尾 public void add(int index,Object o)将对象o插入到向量的指定位置 public void addElements(Object o)将对象o添加到向量的末尾 public boolean contains(Object o)判断对象o是否为向量的成员 public Object elementAt(int index)获取指定位置处的成员,5.8 Vector类,public Object get(int index)获取向量指定位置处的成员 public Object firstElement()获取此向量的第一个成员 public Object lastElement()获取此向量的最后一个成员 public int indexOf(Object o)获取对象在此向量中首次出现的位置 public int indexOf(Object o,int index)从指定位置查找对象o在此向量中首次出现的位置 public int lastIndexOf(Object o)获取对象o在此向量中最后出现的位置 public int lastIndexOf(Object o,int index)对象o在此向量位置index之前最后出现的位置。,5.8 Vector类,public Object remove(int index)从此向量中删除指定位置处的成员,并返回这个成员 public void removeAllElements()删除向量的所有成员 public boolean removeElement(Object o)删除第一次出现的成员o public boolean removeElement(int index)删除指定位置处的成员 public void set (int index,Object o)把指定位置处的成员用o替换掉 public void setElementAt(Object o,int index)把指定位置处的成员用o替换掉 public Enumeration elements()获取一个枚举对象。,5.8 Vector类,例子17: import java.util.*; class Example5_17 public static void main(String args) Vector vector=new Vector(); for(int i=1;i0) int number=(int)(Math.random()*vector.size(); Integer integer=(Integer)vector.elementAt(number); ai=Value(); /得到整数对象中的int数. vector.removeElementAt(number); /向量移掉number处的整数对象. i+; for(i=0;i18;i+) System.out.print(“ “+ai); ,5.9 LinkedList类,链表是由若干个称做节点的对象组成的一种数据结构,每个节点都含有一个数据和下一个节点对象的引用(单链表),或含有一个数据并含有上一个节点对象的引用和下一个节点对象的引用(双链表),节点的索引从0开始。,5.9 LinkedList类,创建链表 使用java.until包中的LinkedList类创建一个链表。 如: LinkedList mylist=new LinkedList(); 创建了一个空链表 然后添加节点,用add()方法
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025宁夏公路勘察设计院有限责任公司招聘10岗21人笔试参考题库附带答案详解
- 2025云南昭通发展国有资产投资管理有限公司招10人笔试参考题库附带答案详解
- 2024年黄山祁门县国有投资集团人才招聘2人(二次)笔试参考题库附带答案详解
- 迎春灯饰合同协议
- 摄影报像合同协议
- 认购协议书跟合同
- 2025年度合同执行审计
- 租山林地合同协议
- 双方私了协议书样本
- 引流广告合同协议
- 主要单元工程、重要隐蔽工程、工程关键部位的概念及验收签证
- 维生素K2行业研究、市场现状及未来发展趋势(2020-2026)
- 定远县蔡桥水库在建工程实施方案
- GB 13296-2013 锅炉、热交换器用不锈钢无缝钢管(高清版)
- 社会体育指导员的社会责任
- 中华护理学会科研课题申请书
- 相互尊重、理解、信任.ppt
- 压盖机设计说明书参考资料(精编版)
- 区间盾构始发关键节点评估报告
- ××关于深化政府采购制度改革的实施意见
- 建筑构造上册——门和窗一PPT课件
评论
0/150
提交评论