1

Programming in java, lots of false errors.

view story
linux-howto

http://forums.fedoraforum.org – Just trying to put together a small program which should be straight forward but having issues. Also, I'm using openjdk. What I input in vim; -------- mport java.util.Scanner; import java.text.DecimalFormat; import java.* //was troubleshooting public class phy114 { public static void main( String [] args ) { char continue = 'y'; Scanner scan = new Scanner (System.in); while ( continue != n) { System.out.print ("Enter V> "); float v = scan.nextFloat(); System.out.print ("Enter d(pc)"; float d = scan.nextFloat(); float mv = v - 5(Math.log(d)+5); System.out.print ("Mv = " +mv ); System.out.print ("Continue, y/n"); continue = scan.nextChar(); } System.out.print ("Process terminated"); } } --------------------------- I seem to get a lot of false errors. output from javac --------------------------- $ javac phy114.java phy114.java:3: ';' expected import java.* ^ phy114.java:11: not a statement char continue = 'y'; ^ phy114.java:11: ';' expected char continue = 'y'; ^ phy114.java:11: ';' expected char continue = 'y'; ^ phy114.java:15: illegal start of expression while ( continue != n) ^ phy114.java:15: illegal start of expression while ( continue != n) ^ phy114.java:15: ';' expected while ( continue != n) ^ phy114.java:15: illegal start of expression while ( continue != n) ^ phy114.java:15: ';' expected while ( continue != n) ^ phy114.java:19: ')' expected System.out.print ("Enter d(pc)"; ^ phy114.java:21: ';' expected float mv = v - 5(Math.log(d)+5); ^ phy114.java:21: not a statement float mv = v - 5(Math.log(d)+5); ^ phy114.java:21: ';' expected float mv = v - 5(Math.log(d)+5); ^ phy114.java:24: ';' expected continue = scan.nextChar(); ^ phy114.java:26: <identifier> expected System.out.print ("Process terminated"); ^ phy114.java:26: illegal start of type System.out.print ("Process terminated"); ^ phy114.java:28: class, interface, or enum expected } ^ 17 errors ------------------------------ (HowTos)