Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

have a text file named students.txt that has data like the below 412 18 male drumming 446 23 female running ... (keeps on going with

have a text file named students.txt that has data like the below


412 18 male drumming

446 23 female running

... (keeps on going with this structure 1.student number 2.age 3.gender 4. hobby)

How could I save this into an array (I know how to (do this) in arraylist but I want to know how to save each row into an array)


2nd question is if I (create this) array in a class named studentMain (which would be the main method) and wanted to use this array to update the instance variable values in another class named update, like private int studentNumber or private String gender which are originally set to 0 and "", how would I update that? (I thought I could do something like update info = new update(); and info.setStudentNumber()



Step by Step Solution

There are 3 Steps involved in it

Step: 1

For the first question you can read each line from the file split it into separate pieces of data an... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java How To Program Late Objects Version

Authors: Paul Deitel, Deitel & Associates

8th Edition

0136123716, 9780136123712

More Books

Students also viewed these Programming questions