Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java Scanner NoSuchElementException

½ñÌìͬѧÎÊÎÒÒ»¸öJavaÎÊÌ⣬´úÂë½á¹¹ÈçÏ£º
Scanner scan = new Scanner(System.in);
scan.next();
scan.close();
scan = new Scanner(System.in);
scan.next(); 
µ±³ÌÐòÔËÐе½µÚÎåÐÐÊÇ»áÅ׳öjava.util.NoSuchElementException
          at java.util.Scanner.throwFor(Scanner.java:838)
          at java.util.Scanner.next(Scanner.java:1347)
ÓÚÊǰ´ÕÕ´íÎóÕ»µÄ¹ì¼£²éÕÒÔ­Òò¡£
¼òÒªµÄ˵£¬¾ÍÊÇǰºóÁ½´ÎʵÀý»¯µÄ²ÎÊýSystem.inÊÇÓÃÒ»¸ö¶ÔÏó£¬ÊÇInputStreamReader¶ÔÏó£¬Ã¿¸ö¸Ã¶ÔÏó°üº¬Ò»¸ö
StreamDecoder ÊµÀý sd
private final StreamDecoder sd;  
¶øscan.close()·½·¨Îª
public void close() {
if (closed)
return;
if (source instanceof Closeable) {
try {
((Closeable)source).close();
} catch (IOException ioe) {
lastException = ioe;
}
}
sourceClosed = true;
source = null;
closed = true;
}  
µ±Ö´Ðе½ ((Closeable)source).close();¾Í»á½øÈëInputStreamReaderµÄclose()·½·¨£º
public void close() throws IOException {
sd.close();
}  
ÕâÀïµÄsd¾ÍÊÇÉÏÃæÌáµ½µÄInputStreamReader¶ÔÏ󣬣¨ÓвéÁËStreamDecoder Ô´´úÂ룬µ«Ã»¸üÉîÈëÏÂÈ¥£©£¬´ËʱsdÒѹرա£
µ±Ö´ÐÐÈç´íÎó²úÉú´úÂëµÄµÚ5ÐдúÂë scan.next()ʱ£¬
public String next() {
ensureOpen();
clearCaches();

while (true) {
String token = getCompleteTokenInBuffer(null);
if (token != null) {
matchValid <mce:script type="text/javascript" src="http://hi.images.csdn.net/js/blog/tiny_mce/themes/advanced/langs/zh.js" mce_src="http://hi.images.csdn.net/js/blog/tiny_mce/themes/advanced/langs/zh.js"></mce:script><mce:script type="text/javascript" src="http://hi.images.csdn.net/js/blog/tiny_mce/plugins/syntaxhl/lan


Ïà¹ØÎĵµ£º

JAVAÖÐFileHelperµÄÒ»¸öÓ÷¨

 public boolean writeXML(String content, String filename)
    {  
        String savepath;
        FileOutputStream fout;
//        log.info("content:"+content+ ......

JavaÄÚ´æÒç³öµÄÏêϸ½â¾ö·½°¸(ת)

¹Ø¼ü×Ö: java.e800.com.cn/articles/2007/413/1176400876794405339_1.htm
http://java.e800.com.cn/articles/2007/413/1176400876794405339_1.html
±àÕß°´£ºJavaÄÚ´æÐ¹Â©ÊÇÿ¸öJava³ÌÐòÔ±¶¼»áÓöµ½µÄÎÊÌ⣬³ÌÐòÔÚ±¾µØÔËÐÐÒ»ÇÐÕý³££¬¿ÉÊDz¼Êðµ½Ô¶¶Ë¾Í»á³öÏÖÄÚ´æÎÞÏÞÖÆµÄÔö³¤£¬×îºóϵͳ̱»¾£¬ÄÇôÈçºÎ×î¿ì×îºÃµÄ¼ì²â³ÌÐòµÄÎ ......

javaÎļþ¹ýÂËÆ÷µÄʹÓÃ

javaÎļþ¹ýÂËÆ÷µÄʹÓôúÂëÈçÏ£º
²âÊÔ´úÂ룺package file;
import java.io.File;
public class fileFilter {
 public static void main(String[] args) {
  File file = new File("d:\\");//ÉèÖÃÎļþ·¾¶
  for (File fileList : file.listFiles(new file.MyFileFilter())) {
   ......

JavaÖеÄÀàÐÍת»»


±¾×÷Æ·²ÉÓÃ֪ʶ¹²ÏíÊðÃû-·ÇÉÌÒµÐÔʹÓÃ-Ïàͬ·½Ê½¹²Ïí 2.5 Öйú´ó½Ðí¿ÉЭÒé½øÐÐÐí¿É¡£
ÎÞÂÛÔÚC/C++»¹ÊÇÔÚJava£¬Ç¿ÖÆÀàÐÍת»»ÒѾ­²»ÊÇİÉúµÄ¸ÅÄîÁË¡£µ«ÊÇÒªÏëÈ«ÃæÕÆÎÕJavaÖÐÀàÐÍת»»µÄÒªµã¿É²»ÄÇô¼òµ¥£¬±¾ÎĽ«´øÁì´ó¼ÒһͬÁ˽âÓйØJavaÀàÐÍת»»µÄËùÓÐÒªµã¡£
ÊýÖµÀàÐ͵ÄÀàÐÍת»»
ÖÚËùÖÜÖª£¬JavaÓÐÁ½ÖÖÊý¾ÝÀàÐÍ£º»ù±¾Êý¾Ý ......

Javaʵѵ

 ÎÒÃÇÿ¸öѧÆÚÄ©¶¼»á½øÐн«½üÒ»¸öÔµÄʵѵ£¬Õâ´ÎJavaʵѵҲ¼´½«½áÊø£¬ÎÒÑ¡µÄ¿ÎÌâÊÇ“¸öÈËÍøÉÏÒøÐÐϵͳ”£¬ÔËÓÃÁËStruts£¬HibernateºÍSpring¿ò¼Ü£¬Í¨¹ýmvcÉè¼ÆÄ£Ê½¡£»ù±¾ËùÓеŦÄܶ¼ÊµÏÖÁË£¬ÔÚʵѵÖÐÕæµÄѧµ½Á˺ܶà֪ʶ£¬Ö®¼äÒ²Óöµ½Á˺ܶàÎÊÌ⣬µ«¶¼Ò»Ò»µÃµ½½â¾ö¡£ÎÒ½øÒ»²½Á˽âÁËStrutsµÄÔËÐÐÔ­Àí£¬ÂíÉÏÃæÁÙ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ