Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.12 seconds.

  1. Replies
    70
    Views
    7,966

    Re: JD1's Personal Development Blog

    You might want to check out the standard code conventions and the JLS, both of which are where we're getting most of these rules.
    Code Conventions for the Java(TM) Programming Language: Contents...
  2. Replies
    70
    Views
    7,966

    Re: JD1's Personal Development Blog

    Well thinking about it as an if/else statement is probably pretty okay, as long as you know that they have to return values (of the same type) and not execute a block like an if statement does.
  3. Replies
    70
    Views
    7,966

    Re: JD1's Personal Development Blog

    Again, just to nitpick, the tertiary (conditional) operator isn't exactly like an if statement- it simply chooses between two values. You can't, for example, do this:


    boolean blue = true;
    blue...
  4. Replies
    70
    Views
    7,966

    Re: JD1's Personal Development Blog

    Case expressions must be constant values. So if you don't know the values ahead of time (if it's based on some calculation that might change, for example), then you can't use a switch.
  5. Replies
    70
    Views
    7,966

    Re: JD1's Personal Development Blog

    From the standard naming conventions: "Braces are used around all statements, even single statements, when they are part of a control structure, such as a if-else or for statement. This makes it...
  6. Replies
    70
    Views
    7,966

    Re: JD1's Personal Development Blog

    Just a few words of advice, take them or leave them:

    Even if an if or a loop only consists of a single statement, you should still surround it with {brackets}. This is not only a standard Java...
Results 1 to 6 of 6