WEBVTT 1 00:00:01.116 --> 00:00:04.116 In previous demos i've used BlueJ to create objects 2 00:00:04.220 --> 00:00:06.220 to call methods of those objects 3 00:00:07.009 --> 00:00:10.000 now i'm going to show you the instructions in Java 4 00:00:10.005 --> 00:00:12.005 that perform the same actions. 5 00:00:13.225 --> 00:00:15.228 I need to open another window in BlueJ 6 00:00:16.001 --> 00:00:17.119 called the terminal window 7 00:00:18.000 --> 00:00:19.117 and i need to choose the option 8 00:00:19.224 --> 00:00:21.221 record method calls, this means as we 9 00:00:21.222 --> 00:00:23.111 perform an action in BlueJ 10 00:00:23.222 --> 00:00:25.114 the equivalent Java instruction 11 00:00:25.115 --> 00:00:27.224 will be shown in the terminal window 12 00:00:29.114 --> 00:00:32.009 and I'm going to resize the main BlueJ window, 13 00:00:32.110 --> 00:00:34.004 so that the terminal window isn't hidden 14 00:00:34.006 --> 00:00:36.008 when I'm working in the main window. 15 00:00:37.004 --> 00:00:40.110 Let's create an object in exactly the same way as before 16 00:00:42.003 --> 00:00:45.114 I'll supply parameters for the constructor 17 00:00:45.223 --> 00:00:49.005 click Ok, and the object is created in the object bench 18 00:00:50.000 --> 00:00:51.227 and here's the equivalent Java instruction 19 00:00:51.229 --> 00:00:54.116 to create exactly that object 20 00:00:56.112 --> 00:00:57.226 let's call a method 21 00:00:58.223 --> 00:01:03.227 going to setPedalRpm to three hundred again as I did before 22 00:01:05.223 --> 00:01:09.006 and there's the Java instruction to call that method. 23 00:01:10.221 --> 00:01:12.116 Let's call the speed method 24 00:01:13.005 --> 00:01:15.115 the speed method returns a value 25 00:01:17.112 --> 00:01:19.001 and again we can see 26 00:01:19.005 --> 00:01:21.226 the instruction to call the speed method, and we can see 27 00:01:22.004 --> 00:01:24.220 the value that was returned by that method. 28 00:01:26.111 --> 00:01:29.227 Let's change the gear, calling the changeGear method 29 00:01:30.111 --> 00:01:35.118 and we will change up so a parameter of one 30 00:01:36.116 --> 00:01:39.222 and here's the instruction to do that 31 00:01:40.223 --> 00:01:43.112 and finally I'll call the speed method again just 32 00:01:43.113 --> 00:01:46.003 to see that the speed has changed 33 00:01:46.228 --> 00:01:48.114 we can see the return value 34 00:01:48.119 --> 00:01:51.006 in the method result dialogue box 35 00:01:51.222 --> 00:01:53.225 and we can see the instruction again to call 36 00:01:53.229 --> 00:01:56.228 the speed method and the return value.