• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Which statements in Java cannot be labelled?

 
Ranch Hand
Posts: 62
Netbeans IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Which statements in Java cannot be labelled? I see,



Doesn't compile. I understand that labelling such statements doesn't make sense but in mock exams I have missed such questions because I don't clearly know what is the logic behind "which kind of statements can be labelled and which cannot be. And what is the reasoning behind it."

During real development labelling statements like int 1 = 10; wouldn't be in wildest of my thoughts though. But for exam it seems like this is important to know.

Many thanks in advance.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear Hrishikesh, check the following topic in the JLS

14.7 Labeled Statements

Regards
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Labeled statements are used in conjunction with break and continue and should appear just before the loop (for, while) when used with continue and can also appear just before a switch statement in case of break
 
knowledge is the difference between drudgery and strategic action -- tiny ad
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic