WEBVTT 1 00:00:00.117 --> 00:00:02.220 In this demo i'm going to show you what happens 2 00:00:02.221 --> 00:00:04.008 when you try to compile code that 3 00:00:04.009 --> 00:00:06.114 breaks the rules in someway 4 00:00:07.227 --> 00:00:10.003 this is the same code you saw in the last demo 5 00:00:10.004 --> 00:00:13.225 for the bicycle class, but with one small change 6 00:00:15.002 --> 00:00:17.223 let's complie this and see what happens. 7 00:00:20.112 --> 00:00:22.223 The first thing we see is an error message 8 00:00:22.224 --> 00:00:24.229 at the foot of the editor window here 9 00:00:25.115 --> 00:00:28.113 this tell us there is a syntax error in the code 10 00:00:28.114 --> 00:00:30.000 something that breaks the rules of the 11 00:00:30.001 --> 00:00:31.117 programming language 12 00:00:33.004 --> 00:00:34.220 the message tries to help us and 13 00:00:34.226 --> 00:00:36.223 explain what the error is 14 00:00:36.227 --> 00:00:39.227 it says semi-colon expected. 15 00:00:40.111 --> 00:00:43.002 One of the rules of Java is that lines of code 16 00:00:43.003 --> 00:00:45.117 should end in a semi-colon 17 00:00:45.118 --> 00:00:47.223 so it looks like we have missed a semi-colon 18 00:00:47.224 --> 00:00:49.221 at the end of one of the lines. 19 00:00:51.117 --> 00:00:54.118 So there is a missing semi-colon, but where 20 00:00:54.229 --> 00:00:57.221 the compiler helps by highlighting in the editor 21 00:00:57.222 --> 00:01:00.005 the line of code where it has found the error. 22 00:01:01.229 --> 00:01:03.110 Thats the same line of code 23 00:01:03.111 --> 00:01:05.000 I edited in the previous demo 24 00:01:05.007 --> 00:01:08.225 and it looks like i've now accidentially deleted a semi-colon 25 00:01:09.226 --> 00:01:12.114 that message was quite straightforward but sometimes it 26 00:01:12.115 --> 00:01:14.004 could be more difficult to understand 27 00:01:14.005 --> 00:01:16.007 what an error message is telling you. 28 00:01:16.222 --> 00:01:19.009 If you click on the question mark button 29 00:01:19.110 --> 00:01:21.005 BlueJ will try to give you a hint 30 00:01:21.006 --> 00:01:24.116 and sometimes these hints can be quite useful 31 00:01:27.110 --> 00:01:29.223 it's certainly not unusual to come across syntax 32 00:01:29.224 --> 00:01:31.116 errors as you're creating code 32 00:01:31.229 --> 00:01:34.001 and one of the important skills of a programmer 33 00:01:34.002 --> 00:01:37.001 is to be able to use the compiler error messages 34 00:01:37.006 --> 00:01:41.003 in order to fix those errors and get the code working. 35 00:01:42.119 --> 00:01:45.008 So now that I understand whats wrong with my code 36 00:01:45.116 --> 00:01:48.118 with the help of the error message, I'm going to fix it. 37 00:01:49.220 --> 00:01:51.221 I just need to put the semi-colon 38 00:01:51.222 --> 00:01:53.116 back at the end of that line 39 00:01:53.227 --> 00:01:56.009 and now I should be able to compile 40 00:01:56.115 --> 00:02:00.111 the code and it compiles with no syntax errors.