Java: Enum parameter in method

后端 未结 7 1751
小鲜肉
小鲜肉 2020-12-29 03:54

I have a method lets say:

private static String drawCellValue(
    int maxCellLength, String cellValue, String align) { }

and as you can no

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 04:17

    This should do it:

    private enum Alignment { LEFT, RIGHT };    
    String drawCellValue (int maxCellLength, String cellValue, Alignment align){
      if (align == Alignment.LEFT)
      {
        //Process it...
      }
    }
    

提交回复
热议问题