Default Java Keywords

Compiled By Unknown - No Comments
The default keyword is used to label the default branch in a switch statement.
  • A default block does not have an implicit ending point. A break statement is typically used at the end of each case or default block to exit the switch statement upon completion of the block.
  • Without a default statement, a switch statement whose argument matches no case blocks will do nothing.
  • Examples
    int arg = ;
    switch (arg)
    {
    case 1:
    
    break;
    case 2:
    
    break;
    default:
    
    break;
    }
    


    Tags:

    No Comment to " Default Java Keywords "