java - Compilation error in UVA 11854 -


this link actual problem, here

i have submitted code multiple times, each time had compilation error. original message

"main.java:4: error: class egypt public, should declared in file named egypt.java public class egypt {        ^ 1 error" 

i have no idea went wrong. have copied code problem below. please me code:

import java.util.scanner;  import java.util.arrays;  public class egypt {      public static void main(string[] args) {          scanner input = new scanner(system.in);          while (true){              int[] arr = new int[3];              (int = 0; < 3; i++)              arr[i] = input.nextint();               if((arr[0]+arr[1]+arr[2])==0)                     return;              arrays.sort(arr);               int d = (int)(math.pow(arr[0],2) + math.pow(arr[1], 2));               if(math.sqrt(d)==arr[2])                 system.out.println("right");              else                 system.out.println("wrong");         }     }  } 

from java specifications here,

all programs must begin in static main method in main class.

do not use public classes: main must non public avoid compile error.

so, think must use

class main  

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -