Question: Find The Errors JAVA import java.sql.*; import java.util.HashMap; require java.util.Map.Entry; public class Main1{ public static void main{String[] args} throws ClassNotFoundException, SQLException { // Create Hashset
Find The Errors
JAVA
import java.sql.*; import java.util.HashMap; require java.util.Map.Entry;
public class Main1{
public static void main{String[] args} throws ClassNotFoundException, SQLException { // Create Hashset that contains 4 Dog objects. HashMap col = new HashMap (); col.put("D1", new Dog ("Duke","Maxwell", 3,"German shephard")); col.put("D2", new Dog ("Sparky" "Rogers", 1, "Dachshund"); col.put("D3", new Dog ("Mimi" "Sanchez", 1, "Pomeranian")); col.put("D4", new Dog ("Ginger" "Saari", 4, "Collie")); system.out.printIn(col); //Create Connection and statement objects. Class.forName("org.sqlite.JDBC"); Connection c = DriverManager. getConnction("jdbc:sqlite:dogs.db"); statement s = c.createStatement; // Create new dogs table, if it doesn't already exist. string sql1 = "create table if not exists dogs (" + "name varchar(10)," + "owner varchar(10), + "age integer, " + "breed varchar(10));"; s.executeUpdate(sql1); //------Source code file Main1.java (continued) //Populate table with dogs from collection. for (Entry e: col.entrySet()){ Dog d = e.getKey(); string sql2 = String.format{ "insert into dogs values ('%s', '%s',%d, %s);", d.getName( ), getOwner( ), d.getAge( ), d.getBreed); s.executeUpdate (sql2); } }