Results 1 to 7 of 7
  1. #1
    A.R
    A.R is offline Member
    Join Date
    Mar 2017
    Posts
    2
    Rep Power
    0

    Default use java.util.Scanner without oop

    hi
    I want to use use java.util.Scanner without oop
    can anyone give me the source code ? that all is in one class
    with getting an int number form imput

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: use java.util.Scanner without oop

    without oop
    What does that mean?

    Look at the API doc for the Scanner class for some sample code.

    Not an Advanced topic.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    A.R
    A.R is offline Member
    Join Date
    Mar 2017
    Posts
    2
    Rep Power
    0

    Default use java.util.Scanner without Object Oriented

    sorry i create this post again ! Because I was logging out every time i go to my last post

    anyway ...


    I want to use use java.util.Scanner without Object Oriented Prgramming (OOP)

    I mean I don't want to use

    java.util.Scanner scanner = new java.util.Scanner (System.in);

    it mean I want to create this "Scanner" Class in my own class so I don't need to "new" it

    I Looked at "Scanner" Class source but it was so long ! and I could not understand

    so can any one give me a source code of "Scanner" that only get a integer number from user ? in a class name "Test"

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: use java.util.Scanner without oop

    want to create this "Scanner" Class in my own class so I don't need to "new"
    Sorry. If you want to use most of java's classes, you will need to create an instance of the class. There are some classes that have static methods that do not require the creation of a class instance. To use the Scanner class's methods you need to create an instance of the class with new.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: use java.util.Scanner without oop

    Why don't you want to use Scanner?
    That's the whole point of having an API library.

    What classes are you allowed to use?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    gozzy is offline Member
    Join Date
    Jan 2017
    Posts
    46
    Rep Power
    0

    Default Re: use java.util.Scanner without oop

    If you're wishing to avoid OOP, you're using the wrong language

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: use java.util.Scanner without oop

    I think there's a bit of a language problem here. And no, I''m not referring to the programming language.

    A.R, were you looking for java.io.Console?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. java.util.Scanner problem
    By CecoI in forum New To Java
    Replies: 13
    Last Post: 06-11-2014, 03:48 PM
  2. java.util.Scanner NoSuchElementException
    By lzw in forum Advanced Java
    Replies: 9
    Last Post: 11-28-2013, 11:22 AM
  3. Using import java.util.Scanner
    By The Taco in forum New To Java
    Replies: 2
    Last Post: 08-10-2013, 09:26 PM
  4. java.util.Scanner not recognised
    By pjm35@st-and.ac.uk in forum New To Java
    Replies: 4
    Last Post: 06-07-2008, 03:32 PM
  5. The import java.util.Scanner cannot be resolved
    By Heather in forum Advanced Java
    Replies: 1
    Last Post: 07-08-2007, 01:05 AM

Posting Permissions

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