How can i achieve this? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 17

How can i achieve this?

Guys I created a login Form (GUI) in java and I wanted the user to be verified from a file created by a file writer.

12th Jun 2017, 4:58 PM
Corne
Corne - avatar
6 Answers
+ 7
You can use the Scanner class. Pass in your File object as the Scanner object's constructor argument and you're good to go. e.g. Scanner fileRead = new Scanner(objFile); System.out.println(fileRead.nextLine()); //Reads and outputs next line in your file so maybe you can go like: String username = fileRead.nextLine();
12th Jun 2017, 5:07 PM
Garikai
Garikai - avatar
0
game
5th Aug 2017, 8:37 PM
Ahmed Osama
0
sas
5th Aug 2017, 8:37 PM
Ahmed Osama
0
sun
5th Aug 2017, 8:37 PM
Ahmed Osama
0
action
5th Aug 2017, 8:37 PM
Ahmed Osama
0
agss
5th Aug 2017, 8:37 PM
Ahmed Osama