Results 1 to 9 of 9

Thread: Java printf

  1. #1
    Java printf

    Member Since
    Mar 06, 2007
    Posts
    6
    Java printf
    when I use system.out.printf("%d", number);

    i get symbol not found error during compiling

    any help would be great

    Thanks

  2. #2
    Java printf

    Member Since
    May 14, 2006
    Posts
    88
    Specs:
    G4 iBook
    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

  3. #3
    Java printf

    Member Since
    Mar 06, 2007
    Posts
    6
    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:

  4. #4
    Java printf
    dekan's Avatar
    Member Since
    Mar 16, 2007
    Posts
    756
    haven't done a lot with xcode, but there is nothing like that in java... juco showed how it works

  5. #5
    Java printf

    Member Since
    May 14, 2006
    Posts
    88
    Specs:
    G4 iBook
    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:

  6. #6
    Java printf

    Member Since
    Mar 30, 2004
    Location
    USA
    Posts
    4,744
    Specs:
    12" Apple PowerBook G4 (1.5GHz)
    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...)

  7. #7
    Java printf

    Member Since
    May 14, 2006
    Posts
    88
    Specs:
    G4 iBook
    Yeh, that's to print to a stream. So I guess if he was writing to a file, that'd be handy.

  8. #8
    Java printf

    Member Since
    Mar 30, 2004
    Location
    USA
    Posts
    4,744
    Specs:
    12" Apple PowerBook G4 (1.5GHz)
    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.

  9. #9
    Java printf

    Member Since
    Mar 06, 2007
    Posts
    6
    Right it is. So is there something wrong with xcode not accepting System.out.printf()?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Java for Mac OS X 10.6 Update 17 latest java version?
    By Applet in forum OS X - Operating System
    Replies: 2
    Last Post: 09-12-2014, 02:07 AM
  2. Difference between Java and Java Script?
    By AliOop in forum OS X - Apps and Games
    Replies: 14
    Last Post: 02-25-2013, 08:42 AM
  3. From where should I disable Java (Java preferences or Safari?)
    By dacoolest in forum OS X - Operating System
    Replies: 10
    Last Post: 04-24-2012, 01:43 PM
  4. Taking screenshot with java applet using java robot class not working
    By sagngh8 in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 07-06-2011, 08:53 AM
  5. Java Problem! Java games freezing!!
    By L33t Walrus in forum Apple Desktops
    Replies: 1
    Last Post: 02-28-2010, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •