Page 2 of 2 FirstFirst 12
Results 21 to 25 of 25

Thread: ArrayList

  1. #21
    Liquify is offline Member
    Join Date
    Oct 2010
    Posts
    12
    Rep Power
    0

    Default

    I thought if the string is part of the student in the Array List that you can remove a student from the list with that string.

  2. #22
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Well you thought wrong.

    What are you trying to remove from the List?
    So what do you think the remove method needs to be passed as a parameter?

  3. #23
    Liquify is offline Member
    Join Date
    Oct 2010
    Posts
    12
    Rep Power
    0

    Default

    Java Code:
    	public static void deleteStudent(ArrayList<Student> students)
     	{
    		Scanner inputS = new Scanner(System.in);
    		String sNum = inputS.next();
     		for(Student s: students)
    		{
    			if(s.FName().equals(sNum))
    			{
    				students.remove(s);
    				break;
    			}	
    		}				
     	}
    nevermind I figured it out. Can u not remove a student from removing a String Int?

  4. #24
    Bake1tEazy is offline Member
    Join Date
    Jan 2011
    Posts
    8
    Rep Power
    0

    Default

    I seem to be at a loss to remove a student as well :o

  5. #25
    Liquify is offline Member
    Join Date
    Oct 2010
    Posts
    12
    Rep Power
    0

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 7
    Last Post: 11-22-2010, 01:26 PM
  2. need help in ArrayList
    By wynects in forum New To Java
    Replies: 6
    Last Post: 11-19-2010, 09:32 AM
  3. Replies: 2
    Last Post: 11-16-2010, 05:51 PM
  4. Creating an ArrayList from an ArrayList
    By Klahking in forum New To Java
    Replies: 17
    Last Post: 09-09-2010, 03:34 PM
  5. Replies: 2
    Last Post: 04-21-2008, 11:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •