197k views
1 vote
Can you identify one syntax error and one logic error in these lines? Why do you think a programmer might have made the logic error

User Shabnam K
by
3.3k points

1 Answer

2 votes

Answer:

If there are no syntax errors, Java may detect an error while your program is running. You will get an error message telling you the kind of error, and a stack trace that tells not only where the error occurred, but also what other method or methods you were in. For example,

Exception in thread "main" java.lang.NullPointerException

at Car.placeInCity(Car.java:25)

at City.<init>(City.java:38)

at City.main(City.java:49)

Step-by-step explanation:

User Phildo
by
3.2k points