Alperen Özdemir Alperen Özdemir - 1 year ago 110
Java Question

Static array before the main method?

I'm learning java and everyweek we have prelab works. This week in a problem's I'm stucked. Actually, I don't understand what I have to do. Can anyone explain the problem and show the solution way. Maybe I missed some critical information. Thank you.

Step 5. Please create a driver class that includes the main method and save it into
Define a static array before the main method. Create the following students and put them into the array.

(If the advisor name is not given use the first constructor, do not write empty string.)

(11, "Jane", "Smith", "EE", "Dr.Deniz")
(22, "Tony", "Wright", "CMPE", "Dr.Can")
(33, "Alex", "Demsey", "MEC", "Dr.Mert")
(44, "Banu", "Yildiz", "IE", "Dr.Tayfun")
(55, "Ted", "White", "MEC", "Dr.Deniz")
(66, "Janet", "Simpson", "MCH", "Dr.Can")
(77, "Hans", "Sun", "IE", "Dr.Deniz")
(88, "John", "Rutz", "CMPE", "Dr.Deniz")
(99, "George", "Luck", "EE")
(10, "Mehmet", "Cetin", "EE")
(15, "Edward", "Murphy", "MEC")
(25, "Sofia", "Ruston", "MCH")

Answer Source

I won't give you all the code, but I'll outline what I think your professor wants you to do:

  1. Create a class Student. It will have to have a few required fields and one optional field (read this SO thread to find out what a mandatory field is).
  2. Before your main class, create a static array of type Student (read this SO thread on static fields)
  3. Populate the static array before the main method is called (read this SO thread on how to populate an array at creation).
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download