i have a file with 2 int's i need to assign them to a variables. the int's are separeated by a space. what method can i use to read each int separeate and then assign it to a variable.

Recommended Answers

All 3 Replies

Try going through the Scanner class. That should be sufficient for your purpose.

You have a whole bunch of threads going. Please mark the ones that are solved "solved". We don't know which thread to respond to and we don't know whether someone else has posted a solution on another thread. It saves us all time, including you, if you don't have multiple threads on what appear to be the same subject. Thanks.

Try going through the Scanner class. That should be sufficient for your purpose.

or read the entire line as a String and use substring and parsing to int's

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.