Follow these steps: Open the Java file Errors.java. Attempt to compile the program. You'll notice the compilation will fail due to some errors. Fix all the compilation errors and compile the program again. Every time you fix an error, add a comment to the line you fixed and indicate which of the three types of errors it was. Now run the program. Once again, you'll encounter some errors (this time, runtime errors). Fix these errors and run the program once again to see if it works

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Follow these steps:
Open the Java file Errors.java.
Attempt to compile the program. You'll notice the compilation will fail due
to some errors. Fix all the compilation errors and compile the program
again. Every time you fix an error, add a comment to the line you fixed and
indicate which of the three types of errors it was.
Now run the program. Once again, you'll encounter some errors (this time,
runtime errors). Fix these errors and run the program once again to see if
it works.
Now run the program and notice the output. You'll notice that there are
some logical errors in the code. Fix these errors and run the program once
again to see if it now correctly displays what it should.
Transcribed Image Text:Follow these steps: Open the Java file Errors.java. Attempt to compile the program. You'll notice the compilation will fail due to some errors. Fix all the compilation errors and compile the program again. Every time you fix an error, add a comment to the line you fixed and indicate which of the three types of errors it was. Now run the program. Once again, you'll encounter some errors (this time, runtime errors). Fix these errors and run the program once again to see if it works. Now run the program and notice the output. You'll notice that there are some logical errors in the code. Fix these errors and run the program once again to see if it now correctly displays what it should.
public class Errors
{
public static void main (String[] args)
{
@ }
}
System.out.println("Welcome to my first program!\n")
String ageStr = "24 years";
int age = Integer.parseInt(ageStr);
11
System.out.println("I'm + age + " years old.");
int three = "3";
int answer Years = age + three;
System.out.println("Total number of years: + answerYears);
int answerMonths = answer Years * 12;
System.out.println("In 3 years and 6 months, I'll be + answerMonths +
11
//Once you've corrected all the errors, the answer should be 330.
months old");
Transcribed Image Text:public class Errors { public static void main (String[] args) { @ } } System.out.println("Welcome to my first program!\n") String ageStr = "24 years"; int age = Integer.parseInt(ageStr); 11 System.out.println("I'm + age + " years old."); int three = "3"; int answer Years = age + three; System.out.println("Total number of years: + answerYears); int answerMonths = answer Years * 12; System.out.println("In 3 years and 6 months, I'll be + answerMonths + 11 //Once you've corrected all the errors, the answer should be 330. months old");
Expert Solution
Step 1

Syntax errors are similar to grammar or spelling errors in a language. They occur when we don't follow the programming guidelines.

Logical errors don’t crash your code but do not give the result you expected.

Runtime errors occur when the program is running after the compilation has been successfully completed. When this error occurs, the program may hang or crash, displaying an error message.

 

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY