Hello,
I used to do do some VB a while back and now i'm trying to start teaching myself Java. But i'm having a little problem.
I've searched the forums and found a couple of very simple examples. Some whice i can relate to my small knowledge of VB.
A temperature program someone had made:
VB Code:
public class MyApp { public static void main ( String[] args ) { Scanner scan = new Scanner( System.in ) ; int temp ; System.out.print( "Enter the temperature: " ) ; temp = scan.nextInt() ; System.out.print( "Activity: ") ; if ( temp >= 80 && temp <= 95 ) { System.out.println( "Swimming" ) ; } else if ( temp > 95 || temp < 20 ) { System.out.println( "Visit our Shop!" ) ; } else if ( temp >= 60 || temp < 80 ) { System.out.println( "Tennis" ) ; } else if ( temp >= 40 || temp < 60 ) { System.out.println( "Golf" ) ; } else if ( temp < 40 ) { System.out.println( "Skiing" ) ; } } }
I'm pretty sure i've installed the JAVA 1.5 correctly, the file name was "jdk-1_5_0_08-windows-i586-p" and i just used the default install directory and didnt change any options.
I'm not sure what IDE i should be using but i found a free one called iGRASP. Please give your views on this, and weather i should chance to a different one.
Anyway - to the problem.
i get an error consisting of:
---------------------------------------------------------
Temperature.java:1: class MyApp is public, should be declared in a file named MyApp.java
public class MyApp
^
Temperature.java:5: cannot find symbol
symbol : class Scanner
location: class MyApp
Scanner scan = new Scanner( System.in ) ;
^
Temperature.java:5: cannot find symbol
symbol : class Scanner
location: class MyApp
Scanner scan = new Scanner( System.in ) ;
^
3 errors
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.
---------------------------------------------------------
From what i can tell from reading other posts about the same thing, i havnt got it installed correctly? is this the case?
Thanks for any help or advice you can give me! Its all greatly appreciated!
Regards
Mathew
