943,955 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2880
  • Java RSS
Aug 19th, 2004
0

comparing java and C ++(labeling)

Expand Post »
While reading a topic in my book on comparison between java and c ++ ... I read one difference .....

java statements can be labeled while c++ statements cant be. Can anybuddy tell the use of labeling in java?
Similar Threads
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004
Aug 19th, 2004
0

Re: comparing java and C ++(labeling)

I assume you are refering to labels like this? http://www.janeg.ca/scjp/flow/labels.html

I personally never use labelling in Java and I rarely see it used. To me it feels like a primitive feature that I'd use back with asm compilers. I think it is good programming practice to avoid constructs that resemble GOTO. Code with GOTOs are generally harder to follow.

Most of the time, I use break and continue without labels. I think the only example of code that I can remember in recent memory that could have benefitted from labels for an parameter-search/optimization problem similar to the basic artificial intelligence algorithm A-Star. Oh actually... I wrote some C code to do with cache tiling optimizations in the processor that might have benefitted from labels, but usually these are exceptions to the rule.


Ed
Reputation Points: 17
Solved Threads: 1
Junior Poster
cosi is offline Offline
153 posts
since Aug 2004
Aug 20th, 2004
0

Re: comparing java and C ++(labeling)

Thanks for all that ... but I needed to know how it works... cuz even if I dont use it in my code ... its not good that I dont learn it.
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Exceptions
Next Thread in Java Forum Timeline: Diverting inputs





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC