2012-05-10 7 views
0

현재 40 행에 '.class'오류가 있습니다. 도움을 주시면 대단히 감사하겠습니다.'.class'예상 오류를 해결하는 방법은 무엇입니까?

import java.io.*; // For File class and FileNotFoundException 
import java.util.Scanner; //For the Scanner class 
import javax.swing.JOptionPane; // For the JOptionPane class 
/** 
* Write a description of class PartB here. 
* 
* @Hubble, Kieran 
* @Version 0.1 
*/ 
public class PartB 
{ 
    public static void main(String[] args) throws FileNotFoundException 
    { 
     File file; //for file input 
     Scanner inputFile; //for file input 
     String fileName; //to hold a file name 
     String paragraph; //to extract the letter frequencies 

     //get a file name from the user. 
     fileName = JOptionPane.showInputDialog("enter " + " the name of the file"); 

     //attempt to open the file. 
     try 
     { 
      file = new File(fileName); 
      inputFile = new Scanner(file); 
      JOptionPane.showMessageDialog(null, "the file was found."); 

      // read the input file, processing data one line at a time 
      while(inputFile.hasNext()) 
      { 
       String str = inputFile.nextLine(); 
       System.out.println(str); 
      } 

      //create an Output file 
      PrintWriter outputFile = new PrintWriter("crackedcode.txt"); 

      while(paragraph.length() > 0) 
      // error is occurring on the next line (line 40) 
      int[]; letterCount = new int[26]; 
      for (int count = 0; count < paragraph.length; count++) { 
       String current = paragraph[count]; 
       char[] letters = current.toCharArray(); 
      } 

      for (int count2 = 0; count2 < letters.length; count2++) { char lett = letters[count2]; if ((lett >= 'A') & (lett <= 'Z')) { 
         letterCount[lett - 'A']++; 
        } 
       } 


      for (char count = 'A'; count <= 'Z'; count++) { 
       System.out.print(count + ": " + 
        letterCount[count - 'A'] + 
        " "); 
      } 
      System.out.println(); 

      // close the input file 
      inputFile.close(); 
     } 

    catch (FileNotFoundException e) 
    { 
     JOptionPane.showMessageDialog(null, "file not found."); 
    } 

    JOptionPane.showMessageDialog(null, "done."); 
    System.exit(0); //terminate program 
} 

} 
+1

자바 스크립트 (위의 줄에서) 그동안의 블록을 포장 할 필요가 Java는 절대적으로 다른 것들입니다. 질문에 다시 답하십시오. – VisioN

+3

라인 40은 무엇입니까? – birryree

답변

6

세미콜론을 제거

int[]; letterCount = new int[26]; 

또한

int[] letterCount = new int[26]; 

해야합니다, 당신은 {}

+0

대단히 감사합니다! 나는 그것을 줄 것이다. – Kieran

관련 문제