my dog learned polymorphism
The moose likes Beginning Java and the fly likes Delimiter help please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Delimiter help please" Watch "Delimiter help please" New topic

Delimiter help please

Josh Mark

Joined: Mar 12, 2013
Posts: 2
Avengers,Joss Whedon,9.0
Panday,Carlo J. Caparas,6.9
Les Miserables,Tom Hooper,7.9

i'm suppose to add those above things from a text file to an arraylist.

and to add those to an arraylist the methods required goes at

I think here is my problem..

am i using the delimiter right to get the movie title, movie director, rating correct?
because of addMovie(String title, String director, double rating) . so if i want to add Avengers,Joss Whedon,9.0 should i use a delimeter
or is there an easier way..
Greg Charles

Joined: Oct 01, 2001
Posts: 2956

First, please UseCodeTags (⇐Click)

I would abandon the useDelimiter() method of Scanner. Instead read in a whole line (which you are doing already) and use the split() of the String class to divide the line into pieces.
I agree. Here's the link:
subject: Delimiter help please
It's not a secret anymore!