Results 1 to 6 of 6
  1. #1
    ras_oscar is offline Member
    Join Date
    Jun 2013
    Posts
    55
    Rep Power
    0

    Default usual coding conventions

    Say just for fun I have a class:

    Java Code:
    public class engine
    {
    int cylinders;
    String fuel;
    String manufcturer;
    int serealnumber;
    
    static engine getfirst(enginelist)
    {
    return [first engine];
    }
    Static engine getnext(PreviousEngine)
    {
    return [NextEngine];
    }
    }
    I want to maintain a linked list of engines and access them sequentially. Is it more usual to declare and define the linked list within class engine or from the main program that uses the class members?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    3,390
    Rep Power
    5

    Default Re: usual coding conventions

    Sorry, but I have no idea what you are asking. And is that supposed to be Java?

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

  3. #3
    ras_oscar is offline Member
    Join Date
    Jun 2013
    Posts
    55
    Rep Power
    0

    Default Re: usual coding conventions

    Let me ask a different way;

    If i want to create a linked list of class members that is accessible to the main () function,is it more common to declare and define the linked list within the scope of the class or the main() funbction?

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,703
    Rep Power
    5

    Default Re: usual coding conventions

    You are looking for black and white situations where there are none. It totally depends on what you will be doing with the list, not what is "common usage". Both are common.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    ras_oscar is offline Member
    Join Date
    Jun 2013
    Posts
    55
    Rep Power
    0

    Default Re: usual coding conventions

    ok, so either can be made to work. Thanks.

    (Sometimes its more important for us newbies to understand the question than the answer)

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

    Default Re: usual coding conventions

    Imagine you have a book. Does it contain a list of other books that have also been written? Or would such a list be held somewhere special like a Library?

Similar Threads

  1. question about coding conventions
    By gib65 in forum New To Java
    Replies: 8
    Last Post: 08-05-2010, 04:24 AM
  2. Usual problem: cannot make a static....
    By hendrix79 in forum New To Java
    Replies: 2
    Last Post: 12-15-2008, 03:19 PM
  3. Naming conventions
    By tim in forum Forum Lobby
    Replies: 10
    Last Post: 11-16-2008, 09:27 PM
  4. namespace conventions from sun....
    By money123 in forum New To Java
    Replies: 3
    Last Post: 07-31-2007, 05:44 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
  •