This week's book giveaway is in the Big Data forum. We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line! See this thread for details.

OK, what am I missing? Here is an example (more or less) from kathy and Berts SJCP Study guide. public class NumberInterrogation { public static void main( String [] args ) { double [] nums = { 10.4, -10.5, Math.PI, 0 } ; for ( int i = 0; i < nums.length ; i++ ) { System.out.print( "nums[ i ] = " + nums[ i ] ) ; System.out.print( " abs = " + Math.abs(nums[i]) ) ; System.out.print( " ceil = " + Math.ceil(nums[i])) ; System.out.println( " floor = " + Math.floor(nums[i])) ; } } } Here is what I get from the compiler [greg@localhost scjp]$ javac NumberInterrogation.java NumberInterrogation.java:5: cannot resolve symbol symbol : variable PI location: class Math double [] nums = { 10.4, -10.5, Math.PI, 0 } ; ^ NumberInterrogation.java:9: cannot resolve symbol symbol : method abs (double) location: class Math System.out.print( " abs = " + Math.abs(nums[i]) ) ; ^ NumberInterrogation.java:10: cannot resolve symbol symbol : method ceil (double) location: class Math System.out.print( " ceil = " + Math.ceil(nums[i])) ; ^ NumberInterrogation.java:11: cannot resolve symbol symbol : method floor (double) location: class Math System.out.println( " floor = " + Math.floor(nums[i])) ; ^ ./Math.java:5: cannot resolve symbol symbol : variable PI location: class Math double [] nums = { 10.4, -10.5, Math.PI, (double) 0 } ; ^ ./Math.java:9: cannot resolve symbol symbol : method abs (double) location: class Math System.out.print( " abs = " + Math.abs(nums[i]) ) ; ^ ./Math.java:10: cannot resolve symbol symbol : method ceil (double) location: class Math System.out.print( " ceil = " + Math.ceil(nums[i])) ; ^ ./Math.java:11: cannot resolve symbol symbol : method floor (double) location: class Math System.out.println( " floor = " + Math.floor(nums[i])) ; ^ 8 errors

Looks good, compiles and runs fine for me. Is it possible that you have overriden the "Math" class in your class path? Look for a "Math.class" file and, if you have it, get rid of it and try again. [ September 11, 2003: Message edited by: Wayne L Johnson ]

Greg Neef
Ranch Hand

Joined: Jun 16, 2003
Posts: 82

posted

0

yep. I was smart enought to realize that calling the dang class Math initially was probably a bad idea but not smart enough to realize that leaving the original Math.class lying around my directory was detrimental. thanks