In simpleton terms, within the try block, the code attempts to establish a connection to a database. It then tries to insert a record into a table within that database, before disconnecting from the database.
Putting it within a try block and having the catch blocks below, means that if something goes wrong in your code at any point, then the code within the corresponding catch block relevant to the particular error that occurs is executed.
In your case, you have two catch blocks, ClassNotFoundException, and SQLException.
Typically, a ClassNotFoundException may occur when the below lines are executed:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ebbill","","");
And a common cause might be that the JDBC Driver is not installed on your project.
An SQLException might be thrown when the below lines are executed:
Statement stat=con.createStatement();
int result=stat.executeUpdate("Insert into tableone values(5,'siva',50,6000)");
And would typically occur because something has gone wrong on the database side when trying to access the database or with the SQL query.
Other exceptions could be thrown, however these would result in your program falling over with less useful error logging and no logic to handle the errors. You could just catch Exception (which would catch any exception thrown) however in the real world this can be considered bad practice as you should know what types of exception may be thrown and handle them appropriately.
In your example, let's suppose that for some reason, we know that occasionally, an SQL Exception may get thrown in an edge case scenario when your application is running. Let's also assume it is not programatically feasible to write code to prevent this from happening, and so we instead just want to log the error, provide a message to the user and the continue with the normal flow of execution for running the program.
If however, a ClassNotFoundException is thrown, let's assume we do not want to continue with the normal running of the application (we would not be able to). So we may instead want to log the error, and output a message to the user advising them to contact their system administrator.
So here we have two different responses to the two different types of error, hence the need for the two catch blocks catching the different types of error.