Hi,
I just started learning Java. As part of the learning, i am working with small examples which are available from the book.
I have written the below program and while compiling i am getting error. The program and error details goes as follows,
//compute distance of light travels using Java long variable. class Light { public static void main(String args[]) { int lightspeed; long days; long seconds; long distance; // approximate speed of light in miles per second light speed = 186000; days = 1000; //specifying the number of days here seconds = days * 24 * 60 * 60; //convert to seconds distance = lightspeed * seconds; //compute distance System.out.print("In " + days); System.out.print(" days light will travel about "); System.out.print(distance + " miles "); } }
I have given the Java file name as 'Light.java'. I have also verified the availability of the java file and compilation path. both are matching. Also, Java file name and class name defined are also same.
Please help me with this.