Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:25:59+00:00 2026-06-14T21:25:59+00:00

I don’t understand why the compiler does not warn me about not catching or

  • 0

I don’t understand why the compiler does not warn me about not catching or throwing an SQLException. Here’s the situation:

I have defined this interface:

public interface GenericDatabaseManager {
    public void createTables(DataBase model) throws SQLException;
}

Then I created this class that implements the given interface:

public class SqliteHelper extends SQLiteOpenHelper implements
        GenericDatabaseManager {

    @Override
    public void createTables(DataBase model) throws SQLException {
        // Code that throws SQLException
    }

And finally I’m calling this SqliteHelper.createTables() from here:

public class DatabaseManager extends CoreModule {
    private boolean createUpdateDB(final String dbString, final String appId) {
        // Previous code...

        if (oldVer == -1) {
            dbCoreModel.addModel(dbModel);
            dbCoreModel.getManager().createTables(dbModel);
            return true;
        }

        // More code...
    }

}

dbCoreModel.getManager() returns a GenericDatabaseManager instance. But the compiler shows no error on dbCoreModel.getManager().createTables(dbModel); line, although this line throws an SQLException.

Does anyone have an idea about why is this happening? Thanks in advance.

EDIT: about SQLException does not need to be catched because it’s a RuntimeException. This is not true. Here’s an example:

import java.sql.SQLException;

interface Interface {
    public void throwsSQLException() throws SQLException;
}

class Test implements Interface {

    @Override
    public void throwsSQLException() throws SQLException {
        throw new SQLException();
    }
}

public class Main {

    public static void main(String[] args) {
        Interface i = new Test();
        i.throwsSQLException();
        System.out.println("Finished");
    }

}

The compiler DOES show an error in i.throwsSQLException(); in this case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:26:00+00:00Added an answer on June 14, 2026 at 9:26 pm

    android.database.SQLException is a runtime exception.

    In java it is not necessary to catch or declare throws for runtime exceptions. Read a detailed description about RuntimeExceptions in java here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't ask me how but I'm in a situation where I have DCPs published
Don't know a whole lot about streams. Why does the first version work using
I don't have much knowledge about the IPv6 protocol, so sorry if the question
(Don't care about the version. IE or not IE.)
Don't know the term for the red validation border, does it have one? I
Don't want to sort the entries. using this does not preserve the order as
Don't understand why #include <Header.h> is not compiling while #include Header.h is compiling with
don't know better title for this, but here's my code. I have class user
Don't quite understand why this copy constructor is not invoked when I build with
don't know if the title describes anything about what I'm trying to say but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.