2017-02-21 40 views
-2

我已經嘗試了所有可能的方法,無論你在本網站提供了什麼,但仍然無法成功編譯。請幫我我很困惑如何在我的系統中編譯這個程序?

import java.util.*; 
    class Test1 
    { 
     public String toString() 
     { 
      return "test"; 
     } 
     public static void main(String\[\] args) 
     { 
      String s = new String("Raja"); 
      System.out.println(s); 
      Integer I = new Integer(10); 
      System.out.println(I); 
      ArrayList l = new ArrayList(); 
      l.add("A"); 
      l.add("B"); 
      System.out.println(l); 
      Test1 t = new Test1(); 
      System.out.println(t); 
     } 
    } 

我收到提示: Picture

+2

本網站沒有提供編譯器。我不知道你在說什麼。你有沒有嘗試過只是谷歌搜索「如何編譯Java」?試試ideone.com:http://ideone.com/buq2yg – tnw

+1

仔細閱讀編譯錯誤,並採取必要的措施。 –

+0

其實我想說的是,無論帖子是否與編譯問題有關,我已經嘗試了這些命令,但編譯沒有獲得成功。有沒有其他的方式來編譯它? –

回答

0
import java.util.ArrayList; 
public class Test1 
{ 
    public String toString() 
    { 
     return "test"; 
    } 
    public static void main(String[] args) 
    { 
     String s = new String("Raja"); 
     System.out.println(s); 
     Integer I = new Integer(10); 
     System.out.println(I); 
     ArrayList<String> l = new ArrayList<String>(); 
     l.add("A"); 
     l.add("B"); 
     System.out.println(l); 
     Test1 t = new Test1(); 
     System.out.println(t); 
    } 
} 

的javac的Test1 的Java測試1

+3

請添加英文來解釋您的代碼如何解決問題。 –

0

彙編,其實。

您關注的消息只是一個警告,尤其是關於這一行:

ArrayList l = new ArrayList(); 

這裏你聲明的ArrayList withouth的提供了一個泛型類型。有關泛型的更多信息,請參閱here