Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting data from command line.

 
Branden Bobo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a simple pre-build class (as of java 7) to read text from the command line?
If not... I wrote my own re-usible helper class... Is this a good approach is there a better way?


p.s. this is my first post on any forum ever so please be nice.
 
Greg Brannon
Bartender
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you aware of Scanner? You can also find many examples of how to use Scanner to do what I think you're trying to do, but I may not understand your question.

Two of the many cool things about Java is that the Core Java API is so rich and that there are many third party libraries that do most anything else the core libraries do not do, or, in some cases, do the same thing only better. I'll relay what I was told early in my Java study, "Don't reinvent the wheel." Instead, I suggest you learn from the inventors who've blazed the trails.
 
Branden Bobo
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you I was not familiar with the Scanner class.
I'm coming from C# so although I've been able to pick the java language quickly,
but I know very little about most of the libraries (of coarse i'm trying to change that.)
 
Randall Twede
Ranch Hand
Posts: 4404
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't feel bad. i have several years of java experience, but it was before Scanner class. i have to learn about it too.
 
Greg Brannon
Bartender
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's cool. Just ask if you have similar, "How do I . . .?" questions. Most basic Java tutorials/books will introduce you to the fundamental classes. Some free books and cheat sheets are available online from which you could quickly cross reference your existing programming knowledge by scanning the reference's Table of Contents.

You should also be aware of the online Java Tutorials that usually come up if you Google a Java topic. For example, if you Google "java input" the first result is the Java Basic I/O Tutorial that covers many I/O topics, including Scanner.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic