Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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.
expand button
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");
expand button
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
Check Mark
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.

 

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