¡¶Java»ù´¡ÈëÃÅ¡· - ¿ÎºóÏ°ÌâÒªµã

²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ

public class Test01 {

public static void main(String[] args) { TreeSet ts = new TreeSet(); ts.add(\ ts.add(\ ts.add(\ ts.add(\ }

Iterator it = ts.iterator(); while(it.hasNext()) {

System.out.println(it.next()); }

}

´úÂë¶þ£º

import java.util.ArrayList; public class Test02 { }

public static void main(String[] args) { }

ArrayList list = new ArrayList(); list.add(\ list.add(\ list.add(\ }

for (String obj : list) {

System.out.println(obj);

´úÂëÈý£º

import java.util.*; public class Test03 { }

public static void main(String[] args) { }

ArrayList list = new ArrayList(); list.add(\list.add(\list.add(\

ListIterator it = list.listIterator(); while(it.hasPrevious()) { }

Object obj = it.previous(); System.out.print(obj+\

´úÂëËÄ£º

import java.util.*; import java.util.Map.*;

²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ

public class Test04 { }

public static void main(String[] args) { }

Map map = new HashMap(); map.put(1, \map.put(2, \map.put(3,\

Set keySet = map.keySet(); Iterator it = keySet.iterator(); while (it.hasNext()) { }

Object key = it.next(); System.out.println(key); map.remove(key);

Îå¡¢¼ò´ðÌâ

1¡¢Ê²Ã´ÊǼ¯ºÏ£¬ÇëÁоټ¯ºÏÖг£ÓõÄÀàºÍ½Ó¿Ú£¿ 2¡¢¼¯ºÏÖеÄList¡¢Set¡¢MapÓÐʲôÇø±ð£¿

3¡¢Çë˵˵CollectionºÍCollectionsµÄÓÐʲôÇø±ð£¿ Áù¡¢±à³ÌÌâ

Çë°´ÕÕÌâÄ¿µÄÒªÇó±àд³ÌÐò²¢¸ø³öÔËÐнá¹û¡£

1¡¢ ʹÓÃArrayList¼¯ºÏ£¬¶ÔÆäÌí¼Ó10¸ö²»Í¬µÄÔªËØ£¬²¢Ê¹ÓÃIterator±éÀú¸Ã¼¯ºÏ¡£

Ìáʾ£º

1£©Ê¹ÓÃadd()·½·¨½«ÔªËØÌí¼Óµ½ArrayList¼¯ºÏÖС£

2£©µ÷Óü¯ºÏµÄiterator()·½·¨»ñµÃIterator¶ÔÏ󣬲¢µ÷ÓÃIteratorµÄhasNext()ºÍnext()·½·¨£¬µü´ú³ö

¼¯ºÏÖеÄËùÓÐÔªËØ¡£

2¡¢ ÔÚHashSet¼¯ºÏÖÐÌí¼ÓÈý¸öPerson¶ÔÏ󣬰ÑÐÕÃûÏàͬµÄÈ˵±×öͬһ¸öÈË£¬½ûÖ¹Öظ´Ìí¼Ó¡£ Ìáʾ£º 1£©PersonÀàÖж¨ÒånameºÍageÊôÐÔ£¬ÖØдhashCode()·½·¨ºÍequals()·½·¨£¬Õë¶ÔPersonÀàµÄname

ÊôÐÔ½øÐбȽϣ¬Èç¹ûnameÏàͬ£¬hashCode()·½·¨µÄ·µ»ØÖµÏàͬ£¬equals·½·¨·µ»Øtrue¡£

3¡¢Ñ¡ÔñºÏÊʵÄMap¼¯ºÏ±£´æ5λѧԱµÄѧºÅºÍÐÕÃû£¬È»ºó°´Ñ§ºÅµÄ×ÔȻ˳ÐòµÄµ¹Ðò½«ÕâЩ¼üÖµ¶ÔÒ»Ò»´òÓ¡³öÀ´¡£ Ìáʾ£º

1£©´´½¨TreeMap¼¯ºÏ¡£

2£©Ê¹ÓÃput()·½·¨½«Ñ§ºÅ(¡°1¡±¡¢¡°2¡±¡¢¡°3¡±¡¢¡°4¡±¡¢¡°5¡±)ºÍÐÕÃû(¡°Lucy¡±¡¢¡°John¡±¡¢¡°Smith¡±¡¢¡°Aimee¡±¡¢¡°Amanda¡±)´æ´¢µ½MapÖУ¬´æµÄʱºò¿ÉÒÔ´òÂÒ˳Ðò¹Û²ìÅÅÐòºóµÄЧ¹û¡£ 3£©Ê¹Óà map.keySet()»ñÈ¡¼üµÄSet¼¯ºÏ¡£

4£©Ê¹ÓÃSet¼¯ºÏµÄiterator()·½·¨»ñµÃIterator¶ÔÏóÓÃÓÚµü´ú¼ü¡£ 5£©Ê¹ÓÃMap¼¯ºÏµÄget()·½·¨»ñÈ¡¼üËù¶ÔÓ¦µÄÖµ¡£

µÚ8Õ IO£¨ÊäÈëÊä³ö£©

Ò»¡¢Ìî¿ÕÌâ

²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ

1¡¢JavaÖеÄIOÁ÷£¬°´ÕÕ´«ÊäÊý¾Ý²»Í¬£¬¿É·ÖΪ____ºÍ____¡£

2¡¢ÔÚJavaÖУ¬____ÀàÓÃÓÚ²Ù×÷´ÅÅÌÖÐÎļþºÍĿ¼£¬Î»ÓÚ____°üÖС£

3¡¢ÔÚJavaÖУ¬___ÀàÓÃÀ´°ÑÁ½¸ö»ò¸ü¶àµÄInputStreamÊäÈëÁ÷¶ÔÏóºÏ²¢Îªµ¥¸öInputStreamÊäÈëÁ÷¶ÔÏó ʹÓá£

4¡¢JavaÖÐÌṩÁËÒ»¸öÀà____£¬Ëü²»µ«¾ßÓжÁдÎļþµÄ¹¦ÄÜ£¬²¢ÇÒ¿ÉÒÔËæ»úµØ´ÓÎļþµÄÈκÎλÖÿªÊ¼Ö´ÐжÁдÊý¾ÝµÄ²Ù×÷¡£

5¡¢ÔÚJavaÖУ¬ÄÜʵÏÖÏ̼߳äͨÐŵÄÁ÷ÊÇ____¡£

6¡¢JavaÖÐÌṩÁËÒ»¸ö¿ÉÒÔÔÚ¶ÁÎļþµÄͬʱ¼Ç¼ÐкŵÄÀ࣬Õâ¸öÀàÊÇ____£¬ËüÊÇ____µÄÖ±½Ó×ÓÀ࣬Ëüͨ¹ý____ºÍ ____·½·¨ÉèÖúͻñÈ¡µ±Ç°Ðкš£ 7¡¢InputStreamReaderÀàÊÇÓÃÓÚ½«____ת»»Îª____¡£

8¡¢System.outÊÇ____ÀàµÄ¶ÔÏ󣬳ÆΪ±ê×¼Êä³öÁ÷£¬µ÷ÓÃSystemÀàµÄ____·½·¨¿ÉÒÔʵÏÖ±ê×¼Êä³öÁ÷µÄÖض¨Ïò¡£

9¡¢JavaÖÐÒ»¸ö×Ö·ûÕ¼ÓÃÁ½¸ö×Ö½Ú£¬ËùÓÐ×Ö·û²ÉÓõĶ¼ÊÇ____Âë±í¡£ 10¡¢BufferedWriterµÄ____·½·¨¿ÉÒÔдÈëÒ»¸ö»»Ðзû¡£ ¶þ¡¢ÅжÏÌâ

1¡¢Èç¹ûÒ»¸öFile±íʾĿ¼ÏÂÓÐÎļþ»òÕß×ÓĿ¼£¬µ÷ÓÃdelete()·½·¨Ò²¿ÉÒÔ½«Æäɾ³ý¡£ 2¡¢×°ÊÎÉè¼ÆģʽÖУ¬×°ÊζÔÏóÓ¦¸Ã°üº¬Ò»¸ö±»×°ÊζÔÏóµÄÒýÓá£

3¡¢Ê¹ÓÃObjectInputStreamÓëObjectOutputStreamÀàÀ´¶ÁÈ¡»ò´æ´¢µÄ¶ÔÏó±ØÐëҪʵÏÖSerializable½Ó¿Ú£¬·ñÔò³ÌÐò½«³öÏÖNotSerializableExceptionÒì³£¡£

4¡¢InputStreamÀàµÄclose()·½·¨ÊÇÓÃÓڹرÕÁ÷²¢ÇÒÊÍ·ÅÁ÷ËùÕ¼µÄϵͳ×ÊÔ´¡£

5¡¢Ò»°ãÀ´Ëµ£¬°Ñ×Ö·ûת»»³É¼ÆËã»úʶ±ðµÄ×Ö½ÚÐòÁгÆΪ½âÂ룬¶ø°Ñ×Ö½ÚÐòÁÐת»»ÎªÆÕͨÈËÄÜ¿´¶®µÄÃ÷ÎÄ×Ö·û³ÆΪ±àÂë¡£ Èý¡¢Ñ¡ÔñÌâ

1¡¢ÏÂÃæÑ¡ÏîÖУ¬ÄÄЩÊDZê×¼ÊäÈëÊä³öÁ÷£¿£¨¶àÑ¡£©

A¡¢System. In B¡¢System. Out C¡¢InputStream D¡¢OutputStream 2¡¢ÒÔÏÂÑ¡ÏîÖУ¬ÄĸöÊÇFileOutputStreamµÄ¸¸Àࣿ

A.File B.FileOutput C.OutputStream D.InputStream 3¡¢FileÀàÖÐÒÔ×Ö·û´®ÐÎʽ·µ»ØÎļþ¾ø¶Ô·¾¶µÄµÄ·½·¨ÊÇ£¿ A¡¢getParent() B¡¢getName() C¡¢getAbsolutePath() D¡¢getPath() 4¡¢ÏÂÃæÄÄЩÊdz£ÓõÄ×Ö·ûÂë±í£¿(¶àÑ¡)

A¡¢ASCII B¡¢UTF-8 C¡¢ISO8859-1 D¡¢GB2312

5¡¢ÒÔÏ´´½¨RandomAccessFileÀàʵÀý¶ÔÏóµÄ´úÂ룬ÄÄЩÊÇÕýÈ·µÄ£¿ £¨¶àÑ¡£© A¡¢RandomAccessFile(new File(¡°D:\\\\itcast\\\\dir1\\\\test.java¡±),¡±rw¡±) B¡¢RandomAccessFile( ¡°D:\\\\itcast\\\\dir1\\\\test.java¡±,¡±r¡±) C¡¢RandomAccessFile( ¡°D:\\\\itcast\\\\dir1\\\\test.java¡±)

D¡¢RandomAccessFile( ¡°D:\\\\itcast\\\\dir1\\\\test.java¡±,¡±wr¡±) 6¡¢ÒÔÏÂÄÄЩÊôÓÚInputStreamÀàµÄ·½·¨£¿£¨¶àÑ¡£©

A¡¢int read(byte[]) B¡¢void flush() C¡¢void close() D¡¢available() 7¡¢ÒÔÏÂÑ¡ÏîÖУ¬ÄĸöÁ÷ÖÐʹÓÃÁË»º³åÇø¼¼Êõ£¿

A ¡¢BuffereOutputStream B¡¢ FileInputStream C¡¢DataOutputStream D¡¢FileReader

8¡¢ÒÔÏÂÑ¡ÏîÖУ¬ÄĸöÊÇFileÀàdelete()·½·¨·µ»ØÖµµÄÀàÐÍ£¿

A¡¢ boolean B¡¢ int C¡¢ String D¡¢ Integer 9¡¢ÒÔÏÂÑ¡ÏîÖУ¬ÄĸöÎļþ²Ù×÷Àà¿ÉÒÔʵÏÖÒ»´Î¶ÁÈë¶à¸öÎļþ£¿

²©Ñ§¹È¡ª¡ªÈÃIT½Ìѧ¸ü¼òµ¥£¬ÈÃITѧϰ¸üÓÐЧ

A¡¢ FileReader B¡¢BufferedReader C¡¢FileInputStream D¡¢SequenceInputStream 10¡¢ÒÔ϶ÔFileÀàµÄpublic boolea isFile()·½·¨µÄÃèÊö£¬ÄĸöÊÇÕýÈ·µÄ£¿

A¡¢ÅжϸÃFile¶ÔÏóËù¶ÔÓ¦µÄÊÇ·ñÊÇÎļþ¡£ B¡¢ÅжϸÃFile¶ÔÏóËù¶ÔÓ¦µÄÊÇ·ñÊÇĿ¼¡£ C¡¢·µ»ØÎļþµÄ×îºóÐÞ¸Äʱ¼ä¡£

D¡¢ÔÚµ±Ç°Ä¿Â¼ÏÂÉú³ÉÖ¸¶¨µÄĿ¼¡£

ËÄ¡¢³ÌÐòÌî¿ÕÌâ

1¡¢ÔĶÁÒÔÏ´úÂ룬²¢½«¿Õ´¦ÌîдÍêÕû¡£

import java.io.*;

public static void main(String args[])throws Exception{

int a=4;

BufferedReader br=new BufferedReader(new (System.in)); System.out.println(\ÇëÊäÈëÒ»¸öÊý×Ö\String input= ; int b=Integer.parseInt(input);

public class Test1 {

if(b>a){

int sum=b/a;

System.out.println(sum); }else{

System.out.println(\ÊäÈë´íÎó\ } } }

µ±ÊäÈëµÄÊý×ÖÊÇ8ʱ£¬´òÓ¡Êä³öµÄ½á¹ûÊÇ ¡£ 2¡¢ÒÔÏÂÊÇʹÓÃFileInputStreamÀàÓëFileOutputStreamÀิÖÆÎļþ¡£ÔĶÁÒÔÏ´úÂ룬²¢½«¿Õ´¦ÌîдÍêÕû¡£

import java.io.*; class Test2 {

public static void main(String[] args) {

String file1, file2; int ch = 0;

file1 = \file2 = \try {

FileInputStream fis = new ;

fos=new FileOutputStream(file2); int size= ;

System.out.println(\×Ö½ÚÓÐЧÊý¡¢\ while ((ch = fis.read()) != -1) { }

fis.close(); fos.close();

System.out.write(ch); fos.write(ch);

ÁªÏµ¿Í·þ£º779662525#qq.com(#Ì滻Ϊ@)