• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.exception

 
charishma gottumukkula
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one help me with the code which as a method that adds 2 Integer objects, returns the int result and that throws the exception java.lang.Exception if either parameter is null
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12024
25
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you written so far?
 
charishma gottumukkula
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just started learning java
I just want the sample code to execute that
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by charishma gottumukkula:
I have just started learning java...

Excellent! This is a good exercise to learn with. What do you think this method would look like?
 
charishma gottumukkula
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method which return int
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by charishma gottumukkula:
The method which return int

Okay, so that's...

What else? You said it should add the values represented by two Integer objects, and throw an exception if either of these references is null. Where would this go?
 
charishma gottumukkula
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should go into a result variable
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by charishma gottumukkula:
It should go into a result variable

Do you mean a local variable, like this?

Try putting the pieces together, and we'll help you get it working.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic