Java: Enum parameter in method

后端 未结 7 1754
小鲜肉
小鲜肉 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...
      }
    }
    
    0 讨论(0)
提交回复
热议问题