Package sqlaction; import Java. SQL. *; import Java. util. *; public class MySQL {Private Static connection conn; Private Static Java. SQL. preparedstatement stmtdel; public static void connect () throws exception {class. forname ("com. mySQL. JDBC. driver "); string url =" JDBC: mysql: // localhost/BBS "; Conn = drivermanager. getconnection (URL, "root", ""); stmtdel = Conn. preparestatement ("delete from news where id =? ");} Public static void showall () throws exception {string SQL =" select * From News "; statement stmt = Conn. createstatement (); resultset result = stmt.exe cutequery (SQL); system. out. print ("---- ID ---- title ---- content ---- \ n"); While (result. next () {system. out. print ("|" + result. getstring ("ID") + "|" + result. getstring ("title") + "|" + result. getstring ("content") + "|"); system. out. println () ;}} public static void Delete (int I) throws exception when stmtdel.setint(1, imo-1_system.out.println(stmtdel.exe cuteupdate ();} public static void deleteall (INT array []) throws exception // execute multiple delete operations addbatch {for (INT I = 0; I <array. length; I ++) {stmtdel. setint (1, array [I]); stmtdel. addbatch ();} int resultwait wait until stmtdel.exe cutebatch (); system. out. println (arrays. tostring (result);} public static void main (string ARGs []) throws exception {connect (); system. out. println ("before deletion:"); showall (); system. out. println ("after deletion:"); int array [] = {19,23, 25,29, 30,31, 35}; deleteall (array); showall ();}}