2013-05-18 5 views
-1

텍스트를 인쇄하려고합니다. 알로하는 인쇄하지만 아무 것도 출력하지 않지만 텍스트 바로 위의 루프를 삭제하면 인쇄됩니다. 누군가 나를 위해 이것을 설명 할 수 있습니까? 루프를 유지하려면 (s = 5; s < 0; - s)), 어떻게 작동시킬 수 있습니까? 감사합니다결과를 출력 할 수 없습니다

import java.io.*; 

public class Email13 { 
    static boolean isValidEmailCharacter(char c){ 
     boolean result = false; 
     if((c>='A'&&c<='Z')||(c>='a'&&c<='z')||(c>='0'&&c<='9')||(c=='.')||(c=='-')||(c=='+')) 
      result = true; 
     return result; 
    } 

    public static void main(String[] args) throws Exception{ 
     BufferedReader cin, fin; 
     cin = new BufferedReader(new InputStreamReader(System.in)); 
     //Description 
     System.out.println("Programmer: Minh Nguyen"); 
     System.out.println("Description: This program is to start the final project."); 
     System.out.println();  

     String nameIn, nameOut, deIn, deOut; 
     nameIn=""; 
     nameOut=""; 
     deIn = "fileContainingEmails.txt"; 

     System.out.print("Enter input filename [default:" + deIn + "]: "); 
     nameIn = cin.readLine(); 

     if(nameIn.compareTo("")==0){ 
      nameIn = deIn; 
      deOut = "copyPasteMyEmails.txt"; 
      System.out.print("Enter output filename [default:" + deOut + "]: "); 
      nameOut = cin.readLine(); 
     if(nameOut.compareTo("")==0) 
      nameOut = deOut; 
     } 
     else if(nameIn.compareTo("")>0){ 
      deOut = nameIn; 
      System.out.print("Enter output filename [default:" + deOut + "]: "); 
      nameOut = cin.readLine(); 
      if(nameOut.compareTo("")==0) 
       nameOut = nameIn; 
     } 
     fin = new BufferedReader(new FileReader(nameIn)); 
     //Read the input file 
     while(true){ 
      if(!fin.ready()) break; 
      String lineFromFile; 
      lineFromFile = fin.readLine(); 
      int s, e, hasDot, count; 
      count = 0; 
      for (int i = 0; i < lineFromFile.length(); i++) // for each char in the string...   
      { 
       if(lineFromFile.charAt(i)=='@'){       
        for(s=5; s<0;--s) 
         System.out.println("Aloha");               
       } 
      } 
     } 
     fin.close(); 

     PrintWriter fout; 
     fout = new PrintWriter(new FileWriter(nameOut)); 
     fout.close();   
     } 
} 
+0

뿐만 아니라이 특정 언어의 태그를 추가하세요 만들어 그 루프

for(s=5; s<0;--s) 

를 입력하지 않습니다. –

+0

당신이 처리했다고 생각합니다. 행운을 빕니다. –

+0

@OfirBaruch 질문을 편집 할 수 있습니다. – Maroun

답변

2

s는 0 이상, 그래서는 결코 그냥이

for(s=5; s>0;--s) 
+0

오, 세상에, 너무 감추어 져있어. 감사! –

+0

너무 오래 있었지만 제 대답을 받아 들였어야한다고 생각합니다. – smttsp

관련 문제