Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

One more on Constructor  RSS feed

 
suresh kamsa
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Could anyone tell me why l1 is compile error?
How do aviod that error to make the program error
free?
 
May Pat
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.m1() is throwing an exception. When you make the call, you will need a try catch block. But on l1, you don't have the try catch block. So you get a compiler error.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!