| | |
comparing java and C ++(labeling)
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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?
java statements can be labeled while c++ statements cant be. Can anybuddy tell the use of labeling in java?
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
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
•
•
•
•
In a world without walls or fences,
What use are Windows and Gates.
![]() |
Similar Threads
- comp science 1st year -- C++ or Java?? (Computer Science)
- Hi All, Suret here (Community Introductions)
- Comparing strings in Java? (Java)
- FT Junior Java Developer Needed for Major Media firm in NYC (Software Development Job Offers)
- Java/J2EE Senior Software Engineer (Software Development Job Offers)
- date comparison (JSP)
- SAS help: comparing individual observations (Computer Science)
Other Threads in the Java Forum
- Previous Thread: Exceptions
- Next Thread: Diverting inputs
| Thread Tools | Search this Thread |
3d @param affinetransform android api applet application arc arguments array arrays automation binary bluetooth byte capture chat class classes click client code color compare component count database design detection eclipse eclipsedevelopment encryption error event exception fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer j2me java java.xls javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong print problem producer program programming project projectideas read recursion replaysolutions rim scanner screen server set size sms sort sql string swing terminal threads time transforms tree ui web windows






