iccaros Posted April 5, 2006 Report Share Posted April 5, 2006 ok I have a simple java program but I don't understand why I get this error on printfhere is the center of my program int output; //take user input System.out.print("Enter the first number: "); userInput1 = input.nextInt(); System.out.print("Enter the second number: "); userInput2 = input.nextInt(); System.out.print("Enter The Third number: "); userInput3 = input.nextInt(); output = sumNumbers(userInput1,userInput2,userInput3); System.out.printf("the Sum of your numbers = %d\n",output);the error is The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int) but all the examples on the web show this format??thanks Quote Link to post Share on other sites
jcl Posted April 5, 2006 Report Share Posted April 5, 2006 Is the compiler in Java 1.5 mode? It looks like it isn't autoboxing the int. Quote Link to post Share on other sites
naraku9333 Posted April 5, 2006 Report Share Posted April 5, 2006 (edited) Is the compiler in Java 1.5 mode? It looks like it isn't autoboxing the int.Must not be, I can compile this:public class test{ public static void main(String[] args) { int output = 9; System.out.printf("the Sum of your numbers = %d\n",output); }}fine with 1.5(sun), but not with 1.4(blackdown). Edited April 5, 2006 by naraku9333 Quote Link to post Share on other sites
iccaros Posted April 5, 2006 Author Report Share Posted April 5, 2006 I just compiled with command line javac no problem.. but eclipse gives this error..it is java 1.5 so it must be a missconfig of eclipsewill try agian..thanks.. Quote Link to post Share on other sites
naraku9333 Posted April 5, 2006 Report Share Posted April 5, 2006 I dont know about eclipse, but other IDE's Ive used (JBuilder and JStudio) defaulted to a 1.4 sdk installed in the applications directory, I had to specify my 1.5 jdk. Quote Link to post Share on other sites
iccaros Posted April 5, 2006 Author Report Share Posted April 5, 2006 Thanks for the input..I updated eclipse to 3.11 and now I have to option to default to 1.5 Thanks.. this has been driving me nuts for two days now.. Quote Link to post Share on other sites
iccaros Posted April 5, 2006 Author Report Share Posted April 5, 2006 I dont know about eclipse, but other IDE's Ive used (JBuilder and JStudio) defaulted to a 1.4 sdk installed in the applications directory, I had to specify my 1.5 jdk.does jbuilder or jstudio have a gui builder?? Quote Link to post Share on other sites
naraku9333 Posted April 5, 2006 Report Share Posted April 5, 2006 (edited) I'm fairly sure they do (in fact I am sure jstudio does), I just haven't learned anything about gui's yet (first semester java class). Both are free but require registering to download. Also on the sun developer network downloads page they have three IDE's I believe (jstudio, creator and studio 11). Edited April 5, 2006 by naraku9333 Quote Link to post Share on other sites
iccaros Posted April 5, 2006 Author Report Share Posted April 5, 2006 (first semester java class)me too, this is my second to last semester before I graduate. I left my programing classes till last Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.