跳至內容

Java編譯器

本頁使用了標題或全文手工轉換
維基百科,自由的百科全書

Java編譯器Java程式語言編譯器。Java編譯器最常見的生成檔案是包含Java位元組碼Java類別檔案Java虛擬機器載入Java類別檔案,並解釋即時編譯Java位元組碼機械碼

class secondmax {
     public static void main (String args[]) {
               int n,temp,fmax=0,smax=0;
               Scanner sc=new Scanner(System.in);
               System.out.println("Enter how many numbers will you enter:");
               n=sc.nextInt();
               for(int i=0; i<n; i++) {
                    temp=sc.nextInt();
                    if(i == 0) {
                       fmax=temp;
                    } else if(temp > fmax) {
                       fmax=temp;
                    }
               }
            
            System.out.println("First max: " + fmax);  
            System.out.println("Second max: " + smax);  
     }           
}

外部連結[編輯]