• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

//question of comment

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. class Red {
2. // Comment1
3. // // Comment2
4. /* Comment3 */
5. /* Comment4
6. */
7. /** Comment5 */
8. // /* Comment6 */
9. /* // Comment7 */
10. /* /* Comment8 */
11. /** /* // Comment9 // /* */
12. /* Comment10 */*/
13. /* Comment11 /* Comment12 */ */
14. }
What is the result of attempting to compile the program?
Ans: compile error at line12,13
why??
 
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by chao-long liao:
1. class Red {
2. // Comment1
3. // // Comment2
4. /* Comment3 */
5. /* Comment4
6. */
7. /** Comment5 */
8. // /* Comment6 */
9. /* // Comment7 */
10. /* /* Comment8 */
11. /** /* // Comment9 // /* */
12. /* Comment10 */*/
13. /* Comment11 /* Comment12 */ */
14. }
What is the result of attempting to compile the program?
Ans: compile error at line12,13
why??


Comment 10 has two comment tail character sequences--*/*/. The first one is recognized as the end of the comment, and the second one results in a compiler error. A similar problem exists at the end of comment 12.
[ August 07, 2002: Message edited by: Dan Chisholm ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic