Anyway, Scanner examples can be found in the tutorial I posted, and here's an example of how to do it without the Scanner class:
[CODE=java]import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader buffer =
new BufferedReader( new FileReader("Mai n.java"));
String lineOfText;
while((lineOfTe xt = buffer.readLine ()) != null) {
System.out.prin tln("> "+lineOfTex t);
}
buffer.close();
}
}[/CODE]
Have a look at the java.lang.Integ er class how to parse a String to a numerical value.
...
even i kno this concept but but what i need is.... how you will put this into an array
You needed to use an ArrayList and not an array, right?
Well then, create an instance of an ArrayList and use it's add methof to add Integers to it. That's all there is to it!
; )
You needed to use an ArrayList and not an array, right?
Well then, create an instance of an ArrayList and use it's add methof to add Integers to it. That's all there is to it!
; )
so this would not work
This folowing statement use a while loo to read the data file in a FileInputStream object. called largerfile:
int newByte = 0;
while (newByte != -1) {
newByte =largerfile.rea d();
System.out.prin t(newByte + " ");
}
nomad
No insult intended but you'd better leave this thread to Prometheuzz; he can
handle this fine. He doesn't need your or my intervening remarks here. If you
want to know anything about stream IO feel free to start your own thread about
it and I'll read (and possibly answer) your question too. Prometheuzz is right
on target with this thread; read all about it and feel free to post corrections.
Like I said: I don't know exactly what it is you need help with, and begging for code isn't helping you either.
You had better show me (or us) that you put some effort and research in what I have suggested to you because I pretty much told you what to do in order to finish this assignment.
If there is something not clear to you, then you need to be specific and tell me (us) what it is you don't understand.
Edit: I'll check up on this thread tomorrow morning because it's way passed my bed time (says my girlfriend).
Like I said: I don't know exactly what it is you need help with, and begging for code isn't helping you either.
You had better show me (or us) that you put some effort and research in what I have suggested to you because I pretty much told you what to do in order to finish this assignment.
If there is something not clear to you, then you need to be specific and tell me (us) what it is you don't understand.
Edit: I'll check up on this thread tomorrow morning because it's way passed my bed time (says my girlfriend).
ok dude...
i need help that
i need a coding help to transfer those data to array element....
ok dude...
i need help that
i need a coding help to transfer those data to array element....
Follow the advice that has been given already. If you get stuck with it, no problem. Just post the code that you will have written and see what happens.
Follow the advice that has been given already. If you get stuck with it, no problem. Just post the code that you will have written and see what happens.
[/QUOTE]
thank you people helping in that mean procedure,,,,,, ,,,,,,
i got a code
What are you tryinh to say with: mean procedure? Do you feel you are treated badly?
And what do you mean by: i got a code?
My guess is that the OP managed to scrape a non-understood snippet of code
from the internet somewhere which (sort of) compiles and (sort of) seems to do
what the OP wants it to do. Programming is a mean business indeed ;-)
Confused? Watch out for the next episode for "Teh WAnTeD CodeZ!!!eleven1 1!"
Comment