Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: What exactly is the syntax for println()

  1. #1
    Member
    Join Date
    Feb 2013
    Location
    earth
    Posts
    88
    Thanks
    12
    Thanked 9 Times in 9 Posts

    Default What exactly is the syntax for println()

    Which is correct:

    System.out.in.println("test");

    or

    System.in.out.println("test");

    ???

    I found both examples at Oracle's Java Tutorials.


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: What exactly is the syntax for println()

    Quote Originally Posted by javaiscool View Post
    I found both examples at oracle's javadoc
    I doubt that very much.

    If you go to the System class in the Java API you see that the class has a static variable called out which is a PrintStream object. If you then read about the PrintStream class you will find all the print and println methods belong to that class. Therefore the correct syntax is:
    System.out.println();
    Improving the world one idiot at a time!

Similar Threads

  1. Need help with System.out.println
    By meghabachani in forum Java Theory & Questions
    Replies: 3
    Last Post: June 6th, 2013, 02:55 AM
  2. looping println
    By silverpen10 in forum Java Theory & Questions
    Replies: 8
    Last Post: January 3rd, 2013, 12:39 AM
  3. [SOLVED] println() for JTextArea
    By KILL3RTACO in forum AWT / Java Swing
    Replies: 4
    Last Post: November 28th, 2011, 06:15 PM
  4. what is System,out,println in System.out.println()?
    By koteshk in forum Java Theory & Questions
    Replies: 2
    Last Post: April 18th, 2011, 12:28 AM
  5. println class
    By javanub:( in forum Java Theory & Questions
    Replies: 9
    Last Post: May 18th, 2010, 01:18 AM