相关疑难解决方法(0)

什么时候执行?

我有这个嵌套try的java代码:

try
{   
    try
    {
        [ ... ]
    {
    catch (Exception ex)
    {
        showLogMessage(ex);
        return;
    }

    while (condition == true)
    {
        try
        {
            [ ... ]
        {
        catch (Exception ex)
        {
            showLogMessage(ex);
            continue;
        }

        [ ... ]
    }
}
catch (NumberFormatException e)
{
    showLogMessage(e);
}
finally
{
    doSomeThingVeryImportant();
}
Run Code Online (Sandbox Code Playgroud)

我想知道finally当我得到异常时是否总是执行.我问这个因为catch块有return或有continue声明.

什么时候doSomeThingVeryImportant()执行?当我得到一个Exception时,我NumberFormatException什么时候开始?

我只想要在执行任何catch块之后,也执行finally块.

java android try-catch

8
推荐指数
2
解决办法
3万
查看次数

标签 统计

android ×1

java ×1

try-catch ×1