-
help
i need a help
write the program that prompts the student to enter his name and student number and write it into txt file then store it on specific variable according to it's data type and then print the data stored into variable as " the student name is ....and student number is" the program should handle any exception can happen
-
Re: help
1. Use a meaningful subject line, "help" isn't one.
2. This is a forum, not a homework service. We are prepared to help you to learn -- not to do your work for you aka cheating.
3. Use a capital letter at the start of each sentence and for the first person singular "I." If you're too lazy to depress the shift key, don't be surprised to find that other members here are too lazy to offer help.
Did you take the time to go through the http://www.java-forums.org/forum-gui...w-members.html and http://www.java-forums.org/content/113-forum-rules.html ? No? I thought not.
db
-
Re: help
No one is going to write this for you of course, but we'll be more than glad to help. You should
- Show us what you've done so far
- Show us any compilation errors, exception stacktraces, or any other error messages
- Explain any misbehaviors from your code
- Ask meaningful and specific questions about things you're unsure of.
Do this and you'll likely get lots of help.
Luck.
-
Re: help
I'm not good on java .that's what i done ... i having 2 error ..
import java.io.*;
import java.util.*;
public class FilterStream
{
public static void main(String[] args)
{
Scanner input =new Scanner(System.in);
String name=input.next();
int number=input.nextInt();
try
{
FileOutputStream fos = new FileOutputStream("studentinfo.txt");
DataOutputStream dos = new DataOutputStream(fos);
dos.writeInt(number);
dos.writeUTF(name);
dos.flush();
dos.close();
FileInputStream fis = new FileInputStream("studentinfo.txt");
DataInputStream dis = new DataInputStream(fis);
////// I need here two output two different variable at the same time on a same line how ??
int Id = dis.readInt();
System.out.println(" Id: " + Id);
String name = dis.readUTF();
System.out.println(" Name: " + name);
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
-
Re: help
Please post the error messages, and indicate which lines are causing them.
-
Re: help