compilation - Compiling Error java.io.IOExeption error must be caught or declared -


This is a new error I have not seen before, I would be very grateful for some help

  Import java.util.Scanner; Public class InClass_Module_5 {public static zero main (string [] args) {/ four options; String vehicle 1, vehicle 2, vehicle 3, vehicle 4, ANST; Vehicle 1 = "Mercedes-Benz C 350 Sports Sadon"; Vehicle 2 = "Volkswagen Touregg"; Vehicle 3 = "Nissan Murano"; Vehicle 4 = "Ford F-150"; AnStr = "You have a right vehicle for you!"; System.out.println ("Write the letter corresponding to the vehicle that you want to do:"); Scanner = new scanner (System.in); Four options; System.out.print ("\ nEnter the letter related to the vehicle that you want to do:"); Choice = (four) System.in.read (); If (option> = 'A' and & amp; option & lt; = 'D') // option + = 32; If (likes> = 'A' and & amp; option & lt; = 'd') // options - = 32; System.out.println ("A" + vehicle1); System.out.println ("B." + vehicle2); System.out.println ("C." + Vehicle 3); System.out.println ("D." + Vehicle 4); System.out.println ("You chose the letter:" + option); If (like == 'A') {System.out.println ("" + 1 + ANST); } And if (like == 'B') {System.out.println ("" + + 2+ ANST vehicles); } And if (like == 'C') {System.out.println ("" + + vehicle3 + ANST); } And if (like == 'D') {System.out.println ("" + 4 + ANST); } Else {System.out.println ("You have made a valid selection and will not run anything today!"); }}}   

error :

1 error was found: file: / user / gcaruso / document / cis 110 / module 3 / Module 4 / InClass_Module_5.java [Row: 31] Error: / User / Gkarno / Document / CISS 110 / Module 3 / Module 4 / Inclama_Module_5. Java: 31: unchanged exception java.io.IOException;

In a try / grip block, its line 31 Wrap:

  try {// whatever your line is 31} hold (java.io.IOException) {// your error handling code}   

Some methods have been specified to throw some exceptions (errors) when something goes wrong. Those exceptions should be controlled by the effort / grip block to seize the exception and catch those exceptions to separate the exception and keep it from cascading in full code. See for more information.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -