Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2013
    Location
    Wisconsin, USA
    Posts
    60
    Rep Power
    0

    Default Oversimplifying How A Java Class Is Set Up?

    From what I've read about Java so far, it seems that the layout for a typical Java Class goes something like this:

    [start of .java file]

    PURPOSE:

    comment block describing the purpose of the class and what the class does

    INPUT:
    Class Declaration

    Class Field Declarations

    Class Constructors

    PROCESS:
    Class Methods

    setters

    getters

    (and other java code and methods that do various things with variable-values, including
    passing them around, using them for calculations inside methods, and much more)

    OUTPUT:
    System.out.println();

    [end of .java file]

    Am I correct?

  2. #2
    Gibbo3771 is offline Member
    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Default Re: Oversimplifying How A Java Class Is Set Up?

    New myself and my experience personally goes along the lines of "it depends".

    I have read a couple of different books and they seem to differentiate every so slightly in the layout, so guess it is down to the developer.

    Also some classes only have certain things, like getters/setters, while others do calculations and the others do output etc etc. Tons of ways you can do it from what I have gathered.

  3. #3
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,762
    Rep Power
    5

    Default Re: Oversimplifying How A Java Class Is Set Up?

    Your input and output sections don't really make sense. I would change your input section to something like class contents or structure. Input would be more if console input, file input, web input, DB queries, mouse movements, etc.

    Output could be a variety of things like DB updates, graphics, JTree, or JTables, forms, file output, console output, and so forth. For most computer applications in general there are three parts. Input, processing, output. Sometimes input can be eliminated because it is generated within the program (like finding the first n prime numbers). But there is almost always some processing and always output of some type, otherwise, what's the point.

    Regards,
    Jim
    Last edited by jim829; 08-24-2013 at 02:27 AM.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Java class method to another class
    By snobbysteven in forum New To Java
    Replies: 2
    Last Post: 05-07-2013, 08:03 AM
  2. Replies: 8
    Last Post: 12-14-2012, 02:01 PM
  3. Replies: 6
    Last Post: 03-01-2012, 03:07 PM
  4. Replies: 3
    Last Post: 01-26-2012, 11:20 PM
  5. Replies: 14
    Last Post: 05-28-2009, 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
  •