New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Java printf


Post Reply New Thread Subscribe

 
Thread Tools
macnoob

 
Member Since: Mar 06, 2007
Posts: 6
macnoob is on a distinguished road

macnoob is offline
when I use system.out.printf("%d", number);

i get symbol not found error during compiling

any help would be great

Thanks
QUOTE Thanks
juco

 
Member Since: May 14, 2006
Posts: 88
juco is on a distinguished road
Mac Specs: G4 iBook

juco is offline
Try:

System.out.print(number);
OR
System.out.println(number); // For a new line after the print.

The above is assuming number is declared:
int number = 5;

System API: http://java.sun.com/j2se/1.5.0/docs/...ng/System.html
QUOTE Thanks
macnoob

 
Member Since: Mar 06, 2007
Posts: 6
macnoob is on a distinguished road

macnoob is offline
So the option printf is not available in xcode 2.4.1? because I ran the same method in netbeans ide and it worked fine. I'm a bit confused why xcode don't like the format option?:blind:
QUOTE Thanks
dekan

 
dekan's Avatar
 
Member Since: Mar 16, 2007
Posts: 756
dekan is a jewel in the roughdekan is a jewel in the rough

dekan is offline
haven't done a lot with xcode, but there is nothing like that in java... juco showed how it works
QUOTE Thanks
juco

 
Member Since: May 14, 2006
Posts: 88
juco is on a distinguished road
Mac Specs: G4 iBook

juco is offline
Whether you write your Java in XCode, any IDE or any text editor, the syntax will always be the same.

printf is a C statement :black:
QUOTE Thanks
technologist

 
Member Since: Mar 30, 2004
Location: USA
Posts: 4,744
technologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond repute
Mac Specs: 12" Apple PowerBook G4 (1.5GHz)

technologist is offline
Quote:
Originally Posted by juco View Post
Whether you write your Java in XCode, any IDE or any text editor, the syntax will always be the same.

printf is a C statement :black:
printf(String, Object...)
QUOTE Thanks
juco

 
Member Since: May 14, 2006
Posts: 88
juco is on a distinguished road
Mac Specs: G4 iBook

juco is offline
Yeh, that's to print to a stream. So I guess if he was writing to a file, that'd be handy.
QUOTE Thanks
technologist

 
Member Since: Mar 30, 2004
Location: USA
Posts: 4,744
technologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond reputetechnologist has a reputation beyond repute
Mac Specs: 12" Apple PowerBook G4 (1.5GHz)

technologist is offline
Quote:
Originally Posted by juco View Post
Yeh, that's to print to a stream. So I guess if he was writing to a file, that'd be handy.
Mmm....System.out is an instance of PrintStream.
QUOTE Thanks
macnoob

 
Member Since: Mar 06, 2007
Posts: 6
macnoob is on a distinguished road

macnoob is offline
Right it is. So is there something wrong with xcode not accepting System.out.printf()?
QUOTE Thanks

Post Reply New Thread Subscribe


« noob question | Switching to Xcode »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
weird java problem rerks OS X - Apps and Games 0 01-28-2007 05:59 AM
java question rerks OS X - Operating System 0 01-23-2007 03:05 AM
Java update 1.4.1 is out rman OS X - Operating System 1 04-30-2006 01:05 PM
Java From Terminal jdgti OS X - Development and Darwin 10 03-26-2005 07:16 PM
Apple Releases Java 1.4.1 Graphite Apple Rumors and Reports 5 03-10-2003 07:52 PM

All times are GMT -4. The time now is 12:11 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?