473,386 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Printf question

Hi!!!
could somebody plzzzzz tell me why i have an error for this simple code?


int n=5;

System.out.printf("%d",n);

i keep getting this message

xception in thread "main" java.lang.Error: Unresolved compilation problem:
The method printf(String, Object[]) in the type PrintStream is not applicable for the arguments (String, int)


im really confused it used to work with me all the time but now i just re-installed java eclipse and i think its an installation problem, i dont know

thanks in advance
Jul 31 '08 #1
4 2267
Brosert
57
Which version of Eclipse are you running?
What is version is Compiler compliance set to?
Jul 31 '08 #2
im using version 3.1
i've used it before and it was ok
the only difference when i re-installed it is that im using windows vista now and i used to have windows xp
also i used to have it in c/program files directory and now i have it in D directory

do these things make a difference??
Jul 31 '08 #3
Brosert
57
Eclipse needs to be able to see the Java 5.0 files (which it may not be able to now that they have been moved to d:

Make sure Eclipse is pointing to the correct version of Java -> it sounds like you might be picking up an older version of java (again, possibly because you moved the newer one)


You could pass the integer as a (new) Array {val}, or you could use java's print rather than printf - but this hides the problem rather than fixing it....
Jul 31 '08 #4
thanx alot i just fixed the problem :)
it was just like what u said
thanks again
Aug 13 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Wenjie | last post by:
Hello, Is printf("%d", var); OK for the unsigned long var = SOME_VAR? Or should some other print format be specified? Thanks and best regards, Wenjie
14
by: Mantorok Redgormor | last post by:
Would this by any chance invoke undefined behavior? extern int printf(const char *, ...); int main(void) { printf("Hello\n"); return 0; } That is, providing my own printf prototype would...
188
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
31
by: DeltaOne | last post by:
#include<stdio.h> typedef struct test{ int i; int j; }test; main(){ test var; var.i=10; var.j=20;
12
by: John Devereux | last post by:
Hi, I would like to know if their is a conversion specifier, or other method, that will allow me to not use particular arguments to printf. Failing that, is it permissable to simply "not use"...
11
by: rahul8143 | last post by:
Does printf output depends on compilers or operating systems? I have one program int main() { int i=5; printf("%d %d %d",i++,i++,i++); return 0; } Output of this program on DOS (TC) 7 6 5...
27
by: jacob navia | last post by:
Has anyone here any information about how arrays can be formatted with printf? I mean something besides the usual formatting of each element in a loop. I remember that Trio printf had some...
7
by: Martin Jørgensen | last post by:
Hi, Perhaps a stupid question but I wonder if this isn't possible using C: printf("\nOr push <enter> for default (which is theta=%ld)%s", theta, ": "); It would be nicer to have it on one...
5
by: Why Tea | last post by:
int printf(const char *fmt,...) The fmt is const, indicating that it can't be changed during runtime. If I want to print a series of integers that I only know the largest value beforehand,...
7
by: Rajesh S R | last post by:
printf("%hhd",89);/*Assume char has 8 bits and is signed*/ Is it valid? I know that it has been discussed in comp.std.c. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.