Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java IO program , please help  RSS feed

 
Mohan Mehra
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone this is my first post on this forum. my question is- say i have a file abc.txt with the following contents-"my name is Ron. I am from London. I work in New York." I have to write a java program using IO with hashmap in it to display the output as follows-
Name: Ron
Native: London
Location: New York

please help

Thank you
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may write a Java program that will do the following.

1. Open a file in a Character based Reader

2. Iterate through each line of text, doing the following,
2.1. Split the line into three parts
2.2. Extract Name, Native and Location information and store them into a HashMap

3. Close the file

4. Iterate through the HashMap to print the values
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!