Saturday, 8 June 2013

Code formatting for variable declarations

Code formatting for variable declarations

Is it looked down upon or bad to write multiple variable declarations on the same line? As in:
    boolean playMoreGames = true;           int length;
    boolean win;                            int bodyparts;
    boolean contains;                       char blank = '-';
    String word;                            Scanner fileIn;
    String guess;                           Scanner keyboard = new Scanner(System.in);
vs (standard):
    boolean playMoreGames = true;          
    boolean win;                       
    boolean contains;  
    int length;
    int bodyparts;
    char blank = '-';      
    String word;                           
    String guess;                          
    StringBuilder sb_word;
    Scanner fileIn;
    Scanner keyboard = new Scanner(System.in);

No comments:

Post a Comment