Results 1 to 4 of 4
  1. #1
    MR bruto's Avatar
    MR bruto is offline Senior Member
    Join Date
    May 2013
    Location
    The Netherlands
    Posts
    130
    Rep Power
    0

    Default lol help with a scanner

    lol so i have most of the basic knowledge now, but i learned some shit with System.out in the beginning (with scanners).
    Java Code:
    import java.util.Scanner;
    like:
    Java Code:
    Scanner in = new Scanner (System.out);
    why would i choose the System.out instead of System.in.
    Java Code:
    Scanner in = new Scanner (System.in);
    i know that the System.in is for getting user input, but why would someone use System.out? o.o

    Thanks in advance

  2. #2
    JBelg is offline Member
    Join Date
    Oct 2012
    Posts
    36
    Rep Power
    0

    Default Re: lol help with a scanner

    System.out wouldn't do anything, a Scanner only takes input. (From files or System.in)

  3. #3
    monkeyjr97 is offline Senior Member
    Join Date
    Nov 2012
    Posts
    258
    Rep Power
    2

    Default Re: lol help with a scanner

    You cant use system.out but you can print results from an input scanner.

    e.g. System.out.println("result " + scanner.nextLine());

    you can use a Scanner with a combination of other classes to create an output file writer though, is this what you are on about?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default Re: lol help with a scanner

    Quote Originally Posted by MR bruto View Post
    lol so i have most of the basic knowledge now, but i learned some shit with System.out in the beginning (with scanners).
    Java Code:
    import java.util.Scanner;
    like:
    Java Code:
    Scanner in = new Scanner (System.out);
    why would i choose the System.out instead of System.in.
    Java Code:
    Scanner in = new Scanner (System.in);
    i know that the System.in is for getting user input, but why would someone use System.out? o.o

    Thanks in advance
    When you tried to compile that nonsense, did it compile successfully? If not, what did the compiler say?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Help with Scanner
    By edwed18 in forum New To Java
    Replies: 2
    Last Post: 11-12-2012, 05:28 PM
  2. How to use Scanner ?
    By sandeep43 in forum New To Java
    Replies: 7
    Last Post: 08-10-2011, 01:29 PM
  3. Help With Scanner
    By jtmoney0511 in forum New To Java
    Replies: 10
    Last Post: 10-12-2009, 11:24 PM
  4. Need help with scanner.
    By mainy in forum New To Java
    Replies: 3
    Last Post: 07-28-2009, 02:11 PM
  5. Scanner
    By choko in forum New To Java
    Replies: 10
    Last Post: 01-24-2009, 03:37 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
  •