Recieved error with this: Error: Main method not found in class course_grade.Course_Grade, please define the main method as: public static void main(String[] args) or a JavaFX application class must...

Recieved error with this: Error: Main method not found in class course_grade.Course_Grade, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application Java Result: 1 Someone please write the corrected code. package carplate; import java.io.*; //@author Daniela Lopez public class CarPlate implements Serializable { { String plateNumber; private String state; private String color; public CarPlate() {} // default constructor public static void main(String argsp[]) { new CarPlate(); } public CarPlate(String pNumber, String st, String clr) { plateNumber = pNumber; state = st; color = clr; } // end overloaded constructor @Override public String toString() { String s = "plate number: "+ plateNumber; s += " state: "+state; s += " color: "+color; return s; } // end toString() } // end class CarPlate class TestCarPlate { public static void main(String[] args) throws IOException { CarPlate plate0 = new CarPlate("ABC 123", "New Jersey", "Silver"); CarPlate plate1 = new CarPlate("DEF 1000", "Ohio", "Red"); CarPlate plate2 = new CarPlate("GH 3", "Kentucky", "Blue"); File f = new File("cardata.tmp"); ObjectOutputStream oos = null; try { FileOutputStream fos = new FileOutputStream(f); oos = new ObjectOutputStream(fos); oos.writeObject(plate0); oos.writeObject(plate1); oos.writeObject(plate2); } catch (IOException e) { e.printStackTrace(); } finally { if (oos != null) oos.close(); } // end try int c = 0; CarPlate cp; ObjectInputStream ois = null; try { FileInputStream fis = new FileInputStream(f); ois = new ObjectInputStream(fis); while (true) { cp = (CarPlate) ois.readObject(); System.out.println(cp.toString()); c++; } // end while } catch (EOFException e) { System.out.println("Number of objects = "+c); } catch (ClassNotFoundException e) { System.out.println("Class not found"); } finally { if (ois != null) ois.close(); } // end try } // end main() } // end class TestCarPlate
Dec 06, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here