ArrayList in methods -



ArrayList in methods -

there 2 classes involved, 1 called courseoffering(co), traininginstitution(ti). ti has main method , menu, while co contains of methods.

one of method in ti enrol invoke enrol method in co class, taking in 2 arraylist.

public static void enrol(arraylist <courseoffering> offerings, arraylist <student> students) { system.out.println(courseoffering.enrol(offerings,students)); }

in co class,

public static string enrol(arraylist <courseoffering> offerings, arraylist <student> students) { scanner kb = new scanner(system.in); system.out.println("enter pupil number: "); int input = kb.nextint(); (student s : students){ system.out.println(s); //checking arraylist values if(s.getstudentnumber() == input){ ... ... ... codes goes on.

for there 5 students id increment of 1, starting 1. did println in loop of pupil array list , pupil of id 1 returned. wrong ?

methods arraylist static-methods

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -