हिंदी

The following is the program segment of a JAVA program: amount = 100 while (i>0) { System.out.println(amount); amount = amount - 1; } Rewrite the above using GOTO.

Advertisements

प्रश्न

The following is the program segment of a JAVA program:

amount = 100
while (i>0)
{
System.out.println(amount);
amount = amount - 1;
}

Rewrite the above using GOTO.

लघु उत्तरीय
Advertisements

उत्तर

In Java, the goto statement is not supported. Although goto is a reserved keyword, it cannot be used as a jumping statement.

Therefore, the given program segment cannot be rewritten using goto in Java. Java provides alternative control statements such as break, continue, and labelled statements.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 7: Statements and their Scope - EXERCISE [पृष्ठ १६४]

APPEARS IN

धीरज मेहरोत्रा Computer Science [English] Class 12
अध्याय 7 Statements and their Scope
EXERCISE | Q 10. (c) | पृष्ठ १६४
Advertisements
Share
Notifications



      Forgot password?
Use app×