M
Matt
I am new to exceptions. I have 2 classes A and B, and process() method in class
A will call generateString() method in class B. Exception can happen in class B,
and class A needs to take care of that exception. Below is my code so far,
but not sure what I do in the comment I put below.
public class A
{
public void process()
{
try
{ B b = new B();
String response = b.generateString("a string");
}
catch()
{ //catch exception from class B
}
}
}
public class B
{
public String generateString(String s)
{ //can throw exception if generation has problem
}
}
Please advise. Thanks!!
A will call generateString() method in class B. Exception can happen in class B,
and class A needs to take care of that exception. Below is my code so far,
but not sure what I do in the comment I put below.
public class A
{
public void process()
{
try
{ B b = new B();
String response = b.generateString("a string");
}
catch()
{ //catch exception from class B
}
}
}
public class B
{
public String generateString(String s)
{ //can throw exception if generation has problem
}
}
Please advise. Thanks!!