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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1
00:00:00,000 --> 00:00:03,000
(piano music)

2
00:00:03,000 --> 00:00:05,000
-: So let's solve this problem.

3
00:00:05,000 --> 00:00:07,000
So we are not able to run this code, right?

4
00:00:07,000 --> 00:00:07,000
This is not working.

5
00:00:07,000 --> 00:00:10,000
We want to get hello world on the screen.

6
00:00:10,000 --> 00:00:11,000
It was working with J Shell

7
00:00:11,000 --> 00:00:13,000
because JShell says you just a parse a statement,

8
00:00:13,000 --> 00:00:14,000
I will work.

9
00:00:14,000 --> 00:00:15,000
But then when you build an application,

10
00:00:15,000 --> 00:00:16,000
when you run the application,

11
00:00:16,000 --> 00:00:18,000
how exactly it works behind the scene.

12
00:00:18,000 --> 00:00:21,000
Once we understand that, we can write this code.

13
00:00:21,000 --> 00:00:23,000
So in your machine you will be having something

14
00:00:23,000 --> 00:00:25,000
called JVM.

15
00:00:26,000 --> 00:00:30,000
Now by default, when you say Java is platform independent is

16
00:00:30,000 --> 00:00:33,000
because of JVM, because in your machine you will be having

17
00:00:33,000 --> 00:00:35,000
JVM irrespective of which OS you use.

18
00:00:35,000 --> 00:00:38,000
It can be Windows, Linux based OS, or Mac

19
00:00:38,000 --> 00:00:40,000
or whatever famous OS we have.

20
00:00:40,000 --> 00:00:42,000
It will have JVM installed.

21
00:00:42,000 --> 00:00:45,000
And of course if you have JVM, you can run Java application

22
00:00:45,000 --> 00:00:48,000
and if you don't have JVM, you can't run Java application.

23
00:00:48,000 --> 00:00:51,000
Okay, so we got JVM here, right, now what JVM says,

24
00:00:51,000 --> 00:00:52,000
hey, I will work.

25
00:00:52,000 --> 00:00:56,000
But then this one question, when you say JVM will work,

26
00:00:56,000 --> 00:00:58,000
but JVM works on which environment?

27
00:00:58,000 --> 00:01:00,000
So underlying we have your OS.

28
00:01:00,000 --> 00:01:01,000
So this is your OSS

29
00:01:02,000 --> 00:01:06,000
and then your OS is working on a hardware, right?

30
00:01:06,000 --> 00:01:08,000
So you'll be having an hardware, it can be a laptop,

31
00:01:08,000 --> 00:01:10,000
it can be a desktop, it can be a phone, doesn't matter,

32
00:01:10,000 --> 00:01:12,000
you have an hardware, on top of that we have an OS.

33
00:01:12,000 --> 00:01:15,000
On top of that we have something called JVM.

34
00:01:15,000 --> 00:01:19,000
Now, JVM says, okay, my job is to execute a Java code, okay.

35
00:01:19,000 --> 00:01:22,000
So whatever java code you create, JVM will execute that.

36
00:01:22,000 --> 00:01:26,000
But then JVM will not accept the code directly.

37
00:01:26,000 --> 00:01:28,000
See what happens is Java goes in multiple steps in Java

38
00:01:28,000 --> 00:01:31,000
application, when you as a programmer,

39
00:01:31,000 --> 00:01:33,000
so let's say you are a programmer here

40
00:01:33,000 --> 00:01:34,000
and when you write a code,

41
00:01:34,000 --> 00:01:36,000
you will not directly run write a code which will

42
00:01:36,000 --> 00:01:38,000
run on JVM, okay?

43
00:01:38,000 --> 00:01:40,000
And we don't even do that, right?

44
00:01:40,000 --> 00:01:41,000
We don't even write a code which directly works on the

45
00:01:41,000 --> 00:01:44,000
hardware and we don't even write a code which works

46
00:01:44,000 --> 00:01:45,000
directly on OS.

47
00:01:45,000 --> 00:01:48,000
Java says if you want to make it work, you have

48
00:01:48,000 --> 00:01:50,000
to run your code on JVM,

49
00:01:50,000 --> 00:01:52,000
but then JVM will not understand what you are talking about.

50
00:01:52,000 --> 00:01:54,000
And one more, one more thing we have talked about, right?

51
00:01:54,000 --> 00:01:57,000
Java is platform independent.

52
00:01:57,000 --> 00:01:59,000
So what does platform independence means?

53
00:01:59,000 --> 00:02:01,000
It simply means that you can run your application

54
00:02:01,000 --> 00:02:03,000
on any machine.

55
00:02:03,000 --> 00:02:04,000
So when you write a Java code,

56
00:02:04,000 --> 00:02:06,000
it will run on any machine irrespective

57
00:02:06,000 --> 00:02:07,000
of the hardware or the OS.

58
00:02:07,000 --> 00:02:09,000
But the only thing it requires is

59
00:02:09,000 --> 00:02:11,000
that machine need to have JVM.

60
00:02:11,000 --> 00:02:13,000
So irrespective of which platform I'm talking about,

61
00:02:13,000 --> 00:02:16,000
if it has JVM, your application becomes

62
00:02:16,000 --> 00:02:17,000
platform independent.

63
00:02:17,000 --> 00:02:20,000
But JVM itself is platform dependent, okay?

64
00:02:20,000 --> 00:02:23,000
So example, you can't run JVM on iOS.

65
00:02:23,000 --> 00:02:27,000
So we can't say Java is platform independent when JVM itself

66
00:02:27,000 --> 00:02:29,000
is dependent.

67
00:02:29,000 --> 00:02:33,000
So yes, your application is independent, JVM is not.

68
00:02:33,000 --> 00:02:36,000
So JVM need to be built for a particular OS.

69
00:02:36,000 --> 00:02:37,000
And let's say if it is windows in my,

70
00:02:37,000 --> 00:02:39,000
so in my machine it is Mac,

71
00:02:39,000 --> 00:02:41,000
but let's say if it is Windows,

72
00:02:41,000 --> 00:02:43,000
we have JVM available on Windows.

73
00:02:43,000 --> 00:02:46,000
So your JVM says, Hey, I will run your code

74
00:02:46,000 --> 00:02:49,000
but you have to submit me, not the Java code,

75
00:02:49,000 --> 00:02:51,000
but something called a byte code.

76
00:02:51,000 --> 00:02:55,000
So you have to convert your code into a unreadable format

77
00:02:55,000 --> 00:02:57,000
for a normal human being.

78
00:02:57,000 --> 00:02:59,000
And this is called a byte code

79
00:03:00,000 --> 00:03:03,000
because JVM only understands byte code.

80
00:03:03,000 --> 00:03:05,000
But can you write byte code?

81
00:03:05,000 --> 00:03:06,000
Of course not.

82
00:03:06,000 --> 00:03:08,000
You only understand English type of languages, right?

83
00:03:08,000 --> 00:03:09,000
So whatever we have return the code,

84
00:03:09,000 --> 00:03:12,000
we have a return system dot out dot print,

85
00:03:12,000 --> 00:03:14,000
it's English type language, right?

86
00:03:14,000 --> 00:03:17,000
So what you create is a Java code.

87
00:03:17,000 --> 00:03:20,000
So this is your Java file or Java code,

88
00:03:20,000 --> 00:03:22,000
and then you have to convert this Java code.

89
00:03:22,000 --> 00:03:25,000
So this is Java code, which is more of readable.

90
00:03:25,000 --> 00:03:26,000
This is not something which you can read.

91
00:03:26,000 --> 00:03:29,000
So basically you have to convert this into a Java

92
00:03:29,000 --> 00:03:31,000
code or byte code.

93
00:03:31,000 --> 00:03:33,000
So for that we have something in between here,

94
00:03:33,000 --> 00:03:35,000
which is called a compiler.

95
00:03:35,000 --> 00:03:38,000
Now since this is a Java compiler, we can call it

96
00:03:38,000 --> 00:03:41,000
as Java C, which is Java compiler.

97
00:03:41,000 --> 00:03:44,000
So basically you will write this code.

98
00:03:44,000 --> 00:03:47,000
So this code will be getting compiled into a byte code

99
00:03:47,000 --> 00:03:51,000
and that byte code goes on the JVM, it'll run.

100
00:03:51,000 --> 00:03:52,000
Makes sense, right?

101
00:03:52,000 --> 00:03:54,000
So that means when you write something it will

102
00:03:54,000 --> 00:03:55,000
go into byte code

103
00:03:55,000 --> 00:03:57,000
and then byte code will run on JVM.

104
00:03:57,000 --> 00:04:00,000
Now the only thing is see your project can be a big project,

105
00:04:00,000 --> 00:04:01,000
right, here I'm writing only one file.

106
00:04:01,000 --> 00:04:02,000
It can be 10 lines of code.

107
00:04:02,000 --> 00:04:05,000
It can ,it can be 10 files, it can be a hundred files,

108
00:04:05,000 --> 00:04:06,000
it can be thousand files.

109
00:04:06,000 --> 00:04:10,000
Out of all these files, there will be only one file

110
00:04:10,000 --> 00:04:12,000
with JVM will execute, okay?

111
00:04:12,000 --> 00:04:14,000
JVM will start with the first file

112
00:04:14,000 --> 00:04:16,000
and then of course that file will depend upon

113
00:04:16,000 --> 00:04:18,000
other files and it will execute.

114
00:04:18,000 --> 00:04:22,000
So JVM says you need to tell me what that file is, okay?

115
00:04:22,000 --> 00:04:24,000
So if you, even if you have thousand files which you want

116
00:04:24,000 --> 00:04:27,000
to run in your project, you have to give the first file.

117
00:04:27,000 --> 00:04:30,000
So in this case, what you will do is you will specify, hey,

118
00:04:30,000 --> 00:04:32,000
that's my first file.

119
00:04:32,000 --> 00:04:34,000
So when you run the code, you will specify the first file

120
00:04:34,000 --> 00:04:37,000
and also that file need

121
00:04:37,000 --> 00:04:40,000
to have something called a main method, okay?

122
00:04:40,000 --> 00:04:41,000
So as I, as I mentioned before, right?

123
00:04:41,000 --> 00:04:45,000
We have print in the same way we have main, so your file,

124
00:04:45,000 --> 00:04:48,000
the first file need to have a main method.

125
00:04:48,000 --> 00:04:50,000
So when I say first file, it is not like you have

126
00:04:50,000 --> 00:04:53,000
to follow a sequence, create this file, then that,

127
00:04:53,000 --> 00:04:56,000
that file, out of all the files in your project,

128
00:04:56,000 --> 00:05:00,000
the execution will start from the first file which you

129
00:05:00,000 --> 00:05:01,000
specify, okay?

130
00:05:01,000 --> 00:05:05,000
And that file need to have mean, not just mean,

131
00:05:05,000 --> 00:05:08,000
it is looking for a specific signature.

132
00:05:08,000 --> 00:05:11,000
Okay, so it has a signature, it means the entire method

133
00:05:11,000 --> 00:05:13,000
signature, the method name,

134
00:05:13,000 --> 00:05:16,000
what are the values you are parsing and all this stuff.

135
00:05:16,000 --> 00:05:18,000
And of course all this term you will, you will get used

136
00:05:18,000 --> 00:05:19,000
to in some of these sessions.

137
00:05:19,000 --> 00:05:20,000
Don't worry.

138
00:05:20,000 --> 00:05:21,000
So first you have to make sure

139
00:05:21,000 --> 00:05:25,000
that you provide a mean and mean has a particular signature.

140
00:05:25,000 --> 00:05:27,000
Again, what each word means, that we'll see later.

141
00:05:27,000 --> 00:05:32,000
So the signature is this, it is public static wide mean.

142
00:05:32,000 --> 00:05:35,000
So you have to remember, always parse this method.

143
00:05:35,000 --> 00:05:36,000
I know there are four words,

144
00:05:36,000 --> 00:05:38,000
but then this is the thing you have to remember

145
00:05:38,000 --> 00:05:42,000
and mean will accept some arguments, some parameters.

146
00:05:42,000 --> 00:05:45,000
So you have to parse string A.

147
00:05:45,000 --> 00:05:47,000
Now again, we'll discuss this, what this string is,

148
00:05:47,000 --> 00:05:49,000
what is public static void.

149
00:05:49,000 --> 00:05:50,000
We'll discuss that in some time,

150
00:05:50,000 --> 00:05:52,000
but mean is looking for the signature.

151
00:05:52,000 --> 00:05:55,000
So your code will not work without the signature.

152
00:05:55,000 --> 00:05:57,000
So remember this, so that makes sense.

153
00:05:57,000 --> 00:05:58,000
What are the steps you have to follow?

154
00:05:58,000 --> 00:05:59,000
So the first step is

155
00:05:59,000 --> 00:06:03,000
as a programmer you will be creating a Java file, okay?

156
00:06:03,000 --> 00:06:05,000
Now once your java file is ready, you will put

157
00:06:05,000 --> 00:06:08,000
that into compiler, then compiler will compile it.

158
00:06:08,000 --> 00:06:12,000
Then that code becomes a byte file, a byte code basically.

159
00:06:12,000 --> 00:06:15,000
Then you will take this byte code, you will run that on JVM.

160
00:06:15,000 --> 00:06:18,000
Now, once you, once your JVM says, okay,

161
00:06:18,000 --> 00:06:19,000
I'm running the code, JVM will look

162
00:06:19,000 --> 00:06:21,000
for this particular syntax.

163
00:06:21,000 --> 00:06:23,000
It should be there in your code

164
00:06:23,000 --> 00:06:25,000
and then you will get the output, right?

165
00:06:25,000 --> 00:06:26,000
Simple stuff, okay.

166
00:06:26,000 --> 00:06:27,000
Now there's a space in

167
00:06:27,000 --> 00:06:29,000
between here if you can see, this is a space I have left

168
00:06:29,000 --> 00:06:31,000
that space intentionally

169
00:06:31,000 --> 00:06:32,000
because we'll add certain things there.

170
00:06:32,000 --> 00:06:35,000
So at this point, just remember there's a space here,

171
00:06:35,000 --> 00:06:36,000
there's a box meaning here.

172
00:06:36,000 --> 00:06:38,000
We'll add that box in some time.

173
00:06:38,000 --> 00:06:41,000
Now once we have understood all those things, it's time

174
00:06:41,000 --> 00:06:43,000
to expand this code.

175
00:06:43,000 --> 00:06:44,000
Now if you remember, we have

176
00:06:44,000 --> 00:06:46,000
to write everything in a main, right?

177
00:06:46,000 --> 00:06:50,000
So this section should be a part of,

178
00:06:50,000 --> 00:06:52,000
remember what J will ask you for,

179
00:06:52,000 --> 00:06:54,000
J will ask you for mean.

180
00:06:54,000 --> 00:06:56,000
So we have to put that into mean.

181
00:06:56,000 --> 00:06:59,000
So why the syntax for mean, it's very simple, it is public,

182
00:06:59,000 --> 00:07:00,000
static wide mean.

183
00:07:00,000 --> 00:07:03,000
We have seen that, of course these words will define

184
00:07:03,000 --> 00:07:04,000
that words in the upcoming session.

185
00:07:04,000 --> 00:07:06,000
And once you understand all these terms,

186
00:07:06,000 --> 00:07:08,000
you are java programmer, right?

187
00:07:08,000 --> 00:07:11,000
And then this will say string A and that's it.

188
00:07:11,000 --> 00:07:13,000
This is a syntax you have to follow.

189
00:07:13,000 --> 00:07:14,000
Now there's one more thing.

190
00:07:14,000 --> 00:07:17,000
In Java, now Java is object oriented.

191
00:07:17,000 --> 00:07:19,000
Now what is object oriented means we'll discuss that later.

192
00:07:19,000 --> 00:07:20,000
But in simple terms,

193
00:07:20,000 --> 00:07:24,000
object oriented means everything should be an object.

194
00:07:24,000 --> 00:07:26,000
And to create object we need to class, okay?

195
00:07:26,000 --> 00:07:27,000
Again, we'll discuss all those

196
00:07:27,000 --> 00:07:29,000
things in the upcoming session.

197
00:07:29,000 --> 00:07:31,000
But a class is missing here.

198
00:07:31,000 --> 00:07:34,000
In fact, if you compile this code, this is what your

199
00:07:34,000 --> 00:07:35,000
Java say will tell you.

200
00:07:35,000 --> 00:07:38,000
Java say says, Hey, where is your class?

201
00:07:38,000 --> 00:07:39,000
Your class is missing.

202
00:07:39,000 --> 00:07:40,000
Okay, let's do that.

203
00:07:40,000 --> 00:07:43,000
So let's put that a class here and we'll give a class name.

204
00:07:43,000 --> 00:07:45,000
At this point we'll keep the class name and file them same.

205
00:07:45,000 --> 00:07:48,000
And we'll say, open bracket and close,

206
00:07:48,000 --> 00:07:50,000
and will give an indentation.

207
00:07:50,000 --> 00:07:51,000
So basically we have to follow this

208
00:07:51,000 --> 00:07:53,000
thing, always give a tab.

209
00:07:53,000 --> 00:07:55,000
So every time you open a (indiscernible),

210
00:07:55,000 --> 00:07:56,000
give a tab, it looks good, okay?

211
00:07:56,000 --> 00:07:57,000
There's no compulsion, it looks good

212
00:07:57,000 --> 00:08:01,000
and we love to build stuff which also runs and looks good.

213
00:08:01,000 --> 00:08:02,000
Okay, this looks good, right?

214
00:08:02,000 --> 00:08:04,000
Ignore this X and these suggestions,

215
00:08:04,000 --> 00:08:06,000
these are the suggestions coming from your VS code.

216
00:08:06,000 --> 00:08:07,000
But you know that part in fact is it

217
00:08:07,000 --> 00:08:09,000
because happening of this extension,

218
00:08:09,000 --> 00:08:10,000
let me just remove this.

219
00:08:10,000 --> 00:08:11,000
So let's not use that

220
00:08:11,000 --> 00:08:13,000
extension because it will give you a suggestion.

221
00:08:13,000 --> 00:08:15,000
It's good for development but not for teaching purpose.

222
00:08:15,000 --> 00:08:16,000
So it adds extra text there.

223
00:08:16,000 --> 00:08:17,000
Okay, cool.

224
00:08:17,000 --> 00:08:18,000
So this is how you write your code, okay?

225
00:08:18,000 --> 00:08:21,000
We got a class, a file name,

226
00:08:21,000 --> 00:08:23,000
and then public static void mean, in bracket

227
00:08:23,000 --> 00:08:24,000
you have to mention the parameters.

228
00:08:24,000 --> 00:08:26,000
Again, we'll discuss that later.

229
00:08:26,000 --> 00:08:27,000
And the only thing,

230
00:08:27,000 --> 00:08:30,000
important statement here is system.out.printHelloWorld.

231
00:08:31,000 --> 00:08:33,000
Okay, now let's see if this works.

232
00:08:33,000 --> 00:08:35,000
Let's create the screen and compile.

233
00:08:35,000 --> 00:08:37,000
You can see there's no error.

234
00:08:37,000 --> 00:08:38,000
But the moment I compiled,

235
00:08:38,000 --> 00:08:39,000
if you can see on the left hand side,

236
00:08:39,000 --> 00:08:41,000
we got this extra file.

237
00:08:41,000 --> 00:08:42,000
We got hello.class.

238
00:08:42,000 --> 00:08:44,000
Now this is your byte code.

239
00:08:44,000 --> 00:08:48,000
Remember we have talked about a byte code here.

240
00:08:48,000 --> 00:08:50,000
This is a file which got created automatically.

241
00:08:50,000 --> 00:08:52,000
So when you create a Java file, when you send it

242
00:08:52,000 --> 00:08:55,000
for the compilation, it will create the byte code,

243
00:08:55,000 --> 00:09:00,000
and the extension for the byte code is dot class file.

244
00:09:00,000 --> 00:09:03,000
The extension for java code is dot java file.

245
00:09:03,000 --> 00:09:05,000
And now it is compiled done.

246
00:09:05,000 --> 00:09:07,000
Right, now it's time to run your code.

247
00:09:07,000 --> 00:09:10,000
So remember when I mentioned to run, you have to use JVM,

248
00:09:10,000 --> 00:09:12,000
and for that you have to use a command, which is Java,

249
00:09:12,000 --> 00:09:15,000
and you have to mention the class name, not a file name

250
00:09:15,000 --> 00:09:17,000
this time, just a class name.

251
00:09:17,000 --> 00:09:18,000
The class name is hello.

252
00:09:18,000 --> 00:09:19,000
And say enter.

253
00:09:19,000 --> 00:09:21,000
You can see we got hello world.

254
00:09:21,000 --> 00:09:22,000
So yeah, that's how it works.

255
00:09:22,000 --> 00:09:25,000
So simple stuff, that's how we can able to complete our code

256
00:09:25,000 --> 00:09:27,000
and we are able to run this code.

257
00:09:27,000 --> 00:09:30,000
Now, if you have done until now, give round of applause

258
00:09:30,000 --> 00:09:33,000
or a pat on your back because you deserve it.

259
00:09:33,000 --> 00:09:34,000
So this makes sense, right?

260
00:09:34,000 --> 00:09:35,000
So there's a gap here, right?

261
00:09:35,000 --> 00:09:36,000
So let's remove this gap.

262
00:09:36,000 --> 00:09:39,000
So what we have here, so basically, you know when you,

263
00:09:39,000 --> 00:09:41,000
when you run your code, basically think about your cooking

264
00:09:41,000 --> 00:09:42,000
something in a kitchen, right?

265
00:09:42,000 --> 00:09:43,000
So where do we cook?

266
00:09:43,000 --> 00:09:44,000
Of course in a kitchen, right?

267
00:09:44,000 --> 00:09:46,000
Why not in a hall or in a bedroom?

268
00:09:46,000 --> 00:09:48,000
It's because in the kitchen to cook something,

269
00:09:48,000 --> 00:09:50,000
you need extra things, right?

270
00:09:50,000 --> 00:09:51,000
Example, if you make a bouillon,

271
00:09:51,000 --> 00:09:52,000
I don't know if you know the recipe,

272
00:09:52,000 --> 00:09:53,000
I don't know the recipe,

273
00:09:53,000 --> 00:09:54,000
but if you make a bouillon,

274
00:09:54,000 --> 00:09:56,000
you have to add extra ingredients.

275
00:09:56,000 --> 00:09:58,000
Now those things are kept in the shelf.

276
00:09:58,000 --> 00:10:00,000
So in the kitchen you'll not just have

277
00:10:00,000 --> 00:10:03,000
that resources which are there in the platform,

278
00:10:03,000 --> 00:10:05,000
but also you'll be having extra stuff.

279
00:10:05,000 --> 00:10:08,000
Now, the same way, if you want to run your Java application,

280
00:10:08,000 --> 00:10:11,000
you need extra libraries and you also need a runtime.

281
00:10:11,000 --> 00:10:12,000
The runtime is something which,

282
00:10:12,000 --> 00:10:14,000
where you can run things, right,

283
00:10:14,000 --> 00:10:16,000
now you can run something in a JVM.

284
00:10:16,000 --> 00:10:18,000
So that is part of run.

285
00:10:18,000 --> 00:10:20,000
But then what if you need some extra libraries?

286
00:10:20,000 --> 00:10:22,000
You have to, you need, you need a environment as well.

287
00:10:22,000 --> 00:10:26,000
So we have one more layer here, which is about your OS,

288
00:10:26,000 --> 00:10:29,000
which is called JRE.

289
00:10:29,000 --> 00:10:32,000
So when you want to run something, you use JRE to run it.

290
00:10:32,000 --> 00:10:36,000
Now JRE stands for Java Runtime Environment.

291
00:10:36,000 --> 00:10:38,000
And what is your JVMJ?

292
00:10:38,000 --> 00:10:42,000
JVM stands for Java Virtual Machine.

293
00:10:42,000 --> 00:10:44,000
Okay, so basically we have two things.

294
00:10:44,000 --> 00:10:47,000
We have a JVM and we have a JRE.

295
00:10:47,000 --> 00:10:49,000
Now JVM is a part of JRE.

296
00:10:49,000 --> 00:10:51,000
Now what else you'll be having inside your JVM,

297
00:10:51,000 --> 00:10:53,000
you will be having some libraries.

298
00:10:53,000 --> 00:10:57,000
So JVM with libraries is a part of JRE.

299
00:10:57,000 --> 00:11:00,000
So whenever you run something, it runs inside the JRE

300
00:11:00,000 --> 00:11:04,000
and JVM is actually responsible to run it.

301
00:11:04,000 --> 00:11:06,000
Okay, and by default, when you, when you want

302
00:11:06,000 --> 00:11:08,000
to run your application on any platform, it need

303
00:11:08,000 --> 00:11:10,000
to have JRE, which will have JVM.

304
00:11:10,000 --> 00:11:13,000
Now not every machine will have Java C.

305
00:11:13,000 --> 00:11:15,000
Java C is only for development purpose, right?

306
00:11:15,000 --> 00:11:18,000
So we can imagine this in this section.

307
00:11:18,000 --> 00:11:22,000
So basically we have an outer box, which is your JDK,

308
00:11:22,000 --> 00:11:23,000
which is used by developers.

309
00:11:23,000 --> 00:11:27,000
Inside, which you'll be having something called JRE.

310
00:11:27,000 --> 00:11:29,000
And in this you'll be having JVM.

311
00:11:29,000 --> 00:11:31,000
So as a developer you'll be installing JDK.

312
00:11:31,000 --> 00:11:32,000
JDK will have JRE.

313
00:11:32,000 --> 00:11:34,000
JRE will have JVM.

314
00:11:34,000 --> 00:11:36,000
But to run something on any other machine,

315
00:11:36,000 --> 00:11:38,000
let's say if you have made the application, you want

316
00:11:38,000 --> 00:11:40,000
to run this on your friends machine.

317
00:11:40,000 --> 00:11:41,000
Your friends machine will only have JRE

318
00:11:41,000 --> 00:11:43,000
and JVM.

319
00:11:43,000 --> 00:11:45,000
JDK is not required.

320
00:11:45,000 --> 00:11:48,000
And that's why we say Java is vora, which is write once

321
00:11:48,000 --> 00:11:50,000
and run anywhere, right?

322
00:11:50,000 --> 00:11:52,000
So you just have write on your machine,

323
00:11:52,000 --> 00:11:55,000
you can run it on any other machine, provided you have JRE

324
00:11:55,000 --> 00:11:56,000
and JVM installed.

325
00:11:56,000 --> 00:11:58,000
So that's how your Java works behind the scene.

326
00:11:58,000 --> 00:11:59,000
I hope it makes sense now

327
00:11:59,000 --> 00:12:02,000
and we'll write some more code in the upcoming videos.