Results 1 to 6 of 6
  1. #1
    hjxlpp is offline Member
    Join Date
    May 2013
    Posts
    17
    Rep Power
    0

    Question how to declare the requirement 'take the last element of list, called e'?

    Hi,everyone. I try to submit my assignment. But the system show me an error when i submitted my answer.
    The question have a requirement: if list is not empty take the last element of list, called e

    I just declare
    Java Code:
    int e
    at the beginning. But the auto-mark system show me the declare is not correct. Anyone can show me how to do?

    Thanks very much!

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,924
    Rep Power
    4

    Default Re: how to declare the requirement 'take the last element of list, called e'?

    I am guessing you are just declaring a variable. Yes? Suffix a semi-colon (;).

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    hjxlpp is offline Member
    Join Date
    May 2013
    Posts
    17
    Rep Power
    0

    Default Re: how to declare the requirement 'take the last element of list, called e'?

    Hi,Jim

    Yes, i just at the beginning decalring 'int e;'. It is not correct,right?
    Actually, i can run the project,and the output is correct. But have two warning:
    1.Note: C:\Users\gg\Documents\xx.java uses unchecked or unsafe operations.
    2.Note: Recompile with -Xlint:unchecked for details.

    Could u help me? Thanks very much!
    Last edited by hjxlpp; 07-15-2013 at 06:11 PM.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,924
    Rep Power
    4

    Default Re: how to declare the requirement 'take the last element of list, called e'?

    Are you showing me all of your code? I can't help unless you provide more pertinent information.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: how to declare the requirement 'take the last element of list, called e'?

    Moved from Advanced Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: how to declare the requirement 'take the last element of list, called e'?

    Is this an exercise in the use of generics?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How to pop the element of stack to a list?
    By hjxlpp in forum Advanced Java
    Replies: 3
    Last Post: 07-14-2013, 01:10 PM
  2. popping the last element in a linked list
    By fultonwilcox in forum New To Java
    Replies: 2
    Last Post: 09-14-2012, 04:25 AM
  3. last element of recursive list
    By rokko in forum New To Java
    Replies: 21
    Last Post: 04-02-2012, 05:14 PM
  4. Replies: 4
    Last Post: 02-21-2011, 09:34 AM
  5. Replies: 1
    Last Post: 12-09-2009, 12:57 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
  •