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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
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1
00:00:00,000 --> 00:00:03,000
(piano music)

2
00:00:03,000 --> 00:00:05,000
-: Now once we have our setup done, it's time

3
00:00:05,000 --> 00:00:07,000
to write our first code.

4
00:00:07,000 --> 00:00:08,000
That's right.

5
00:00:08,000 --> 00:00:09,000
So finally we are going

6
00:00:09,000 --> 00:00:12,000
to run our first Java code here.

7
00:00:12,000 --> 00:00:14,000
Now for that we have to open our editor.

8
00:00:14,000 --> 00:00:16,000
So of course in the last video we have discussed

9
00:00:16,000 --> 00:00:18,000
that we are going to use VS code.

10
00:00:18,000 --> 00:00:19,000
So let's open VS code here.

11
00:00:19,000 --> 00:00:21,000
So I will say code.

12
00:00:21,000 --> 00:00:24,000
Okay, so our VS code is all set to write our first code.

13
00:00:24,000 --> 00:00:27,000
You can see it, it will give you a welcome screen

14
00:00:27,000 --> 00:00:29,000
when you do it and then it will ask the preference,

15
00:00:29,000 --> 00:00:34,000
do you want a light color, dark color, dark, high contrast

16
00:00:34,000 --> 00:00:36,000
or light high contrast.

17
00:00:36,000 --> 00:00:39,000
I would say go for dark because it's good for development.

18
00:00:39,000 --> 00:00:41,000
It will not strain your eyes at least.

19
00:00:41,000 --> 00:00:42,000
So let's close this.

20
00:00:42,000 --> 00:00:45,000
Get started and this is how your VS code will look like.

21
00:00:45,000 --> 00:00:46,000
Okay, simple stuff.

22
00:00:46,000 --> 00:00:48,000
Right now what we'll do is first of all

23
00:00:48,000 --> 00:00:49,000
where you will get your folder.

24
00:00:49,000 --> 00:00:52,000
So you will see your folders on the left hand side.

25
00:00:52,000 --> 00:00:53,000
So this is where you will get your project,

26
00:00:53,000 --> 00:00:55,000
all the files which you want to work with.

27
00:00:55,000 --> 00:00:57,000
So you'll be having that here.

28
00:00:57,000 --> 00:00:59,000
Now of course in the upcoming tutorials,

29
00:00:59,000 --> 00:01:00,000
we'll be using a different IDE

30
00:01:00,000 --> 00:01:01,000
and I want you to get used

31
00:01:01,000 --> 00:01:03,000
to different IDs when you work with.

32
00:01:03,000 --> 00:01:06,000
So on the left hand side we can see we have an explorer here

33
00:01:06,000 --> 00:01:07,000
and then we, if you want

34
00:01:07,000 --> 00:01:08,000
to search something, we have it here.

35
00:01:08,000 --> 00:01:11,000
If you want to add some extensions, which we are going

36
00:01:11,000 --> 00:01:14,000
to do later, we will add certain extensions to work with.

37
00:01:14,000 --> 00:01:16,000
At this point, we don't need any extension,

38
00:01:16,000 --> 00:01:17,000
so just keep it blank.

39
00:01:17,000 --> 00:01:19,000
I mean, no need, no need to install anything here.

40
00:01:19,000 --> 00:01:21,000
In my machine I already have something

41
00:01:21,000 --> 00:01:22,000
on some other accounts,

42
00:01:22,000 --> 00:01:24,000
but on this account I don't think so.

43
00:01:24,000 --> 00:01:24,000
Anyway.

44
00:01:24,000 --> 00:01:25,000
And then if you want to run

45
00:01:25,000 --> 00:01:28,000
and debug it, you debug, you will find the option here.

46
00:01:28,000 --> 00:01:30,000
Now why do we run of, of course we know what

47
00:01:30,000 --> 00:01:32,000
to, why to run, right?

48
00:01:32,000 --> 00:01:34,000
But why do we debug the application?

49
00:01:34,000 --> 00:01:35,000
Yeah, we'll see that later.

50
00:01:35,000 --> 00:01:36,000
At this point,

51
00:01:36,000 --> 00:01:39,000
let's open our files of explorer here.

52
00:01:39,000 --> 00:01:42,000
And this is where I want to create my first project.

53
00:01:42,000 --> 00:01:43,000
Now, how do we create a project?

54
00:01:43,000 --> 00:01:46,000
Now project will be a very broad term at this point.

55
00:01:46,000 --> 00:01:48,000
What we are going to do is we will create some files

56
00:01:48,000 --> 00:01:50,000
and of course when you merge these files

57
00:01:50,000 --> 00:01:52,000
and libraries, you create a project.

58
00:01:52,000 --> 00:01:54,000
At this point we do, we are not working

59
00:01:54,000 --> 00:01:55,000
with any external libraries.

60
00:01:55,000 --> 00:01:56,000
At this point,

61
00:01:56,000 --> 00:01:58,000
we are just going for a simple files, okay?

62
00:01:58,000 --> 00:01:59,000
Hello world, right?

63
00:01:59,000 --> 00:02:00,000
So for that

64
00:02:00,000 --> 00:02:02,000
what we'll do is we'll click on open folder

65
00:02:02,000 --> 00:02:04,000
because all these files will be part

66
00:02:04,000 --> 00:02:06,000
of one particular folder.

67
00:02:06,000 --> 00:02:08,000
So we'll click on Open Folder

68
00:02:08,000 --> 00:02:09,000
and it'll give you certain options

69
00:02:09,000 --> 00:02:11,000
where you want to save this.

70
00:02:11,000 --> 00:02:14,000
So I will save this in my desktop itself.

71
00:02:14,000 --> 00:02:16,000
In fact, on my desktop I want to create one more folder.

72
00:02:16,000 --> 00:02:20,000
So I will say open folder again, inside desktop I will,

73
00:02:20,000 --> 00:02:21,000
I want to create a folder here.

74
00:02:21,000 --> 00:02:24,000
We'll say, this is, I will have a short name,

75
00:02:24,000 --> 00:02:27,000
we'll say, Course, Create and Open.

76
00:02:27,000 --> 00:02:29,000
So you can see we got our course folder here.

77
00:02:29,000 --> 00:02:31,000
What I will do is I will zoom in in inside my VS code so

78
00:02:31,000 --> 00:02:33,000
that you can see everything properly.

79
00:02:33,000 --> 00:02:34,000
And again, the recommendation would be

80
00:02:34,000 --> 00:02:36,000
to watch this on a bigger screen so

81
00:02:36,000 --> 00:02:37,000
that you know you can actually

82
00:02:37,000 --> 00:02:38,000
understand each and every line.

83
00:02:38,000 --> 00:02:42,000
Because in mobile, sometime you will be seeing a font size

84
00:02:42,000 --> 00:02:43,000
and a small font.

85
00:02:43,000 --> 00:02:45,000
I don't want to see this page every time I open my VS codes,

86
00:02:45,000 --> 00:02:48,000
so I will just uncheck this and click on close here

87
00:02:48,000 --> 00:02:50,000
and let's create our first file.

88
00:02:50,000 --> 00:02:51,000
And this is where you are going

89
00:02:51,000 --> 00:02:53,000
to write our first code, right?

90
00:02:53,000 --> 00:02:56,000
So we have already seen how do we install JDK, how do we

91
00:02:56,000 --> 00:02:58,000
check the version on the terminal?

92
00:02:58,000 --> 00:03:00,000
Can you do that in this?

93
00:03:00,000 --> 00:03:03,000
So VS code itself has a terminal here, so you don't have

94
00:03:03,000 --> 00:03:04,000
to open the external terminal.

95
00:03:04,000 --> 00:03:06,000
Of course if you're using Windows,

96
00:03:06,000 --> 00:03:09,000
you'll be having an option of command prompt.

97
00:03:09,000 --> 00:03:11,000
But let's click on terminal here

98
00:03:11,000 --> 00:03:12,000
and you can see we have an option

99
00:03:12,000 --> 00:03:14,000
of terminal, click on this one.

100
00:03:14,000 --> 00:03:17,000
This is where you can enter your commands.

101
00:03:17,000 --> 00:03:18,000
Whatever commands you have.

102
00:03:18,000 --> 00:03:19,000
The same command we'll write here.

103
00:03:19,000 --> 00:03:21,000
So we'll say Java version

104
00:03:21,000 --> 00:03:23,000
and you can see I have Java 17 in this machine

105
00:03:23,000 --> 00:03:25,000
and Java 18 is already released.

106
00:03:25,000 --> 00:03:27,000
But then Java 17 is the LTS version.

107
00:03:27,000 --> 00:03:30,000
So when you say LTS, it means long-term support, right?

108
00:03:30,000 --> 00:03:33,000
So we'll use that and we'll also check if my

109
00:03:33,000 --> 00:03:35,000
Java C is working.

110
00:03:35,000 --> 00:03:36,000
You can see Java C is also there.

111
00:03:36,000 --> 00:03:38,000
Now Java C basically stands

112
00:03:38,000 --> 00:03:39,000
for Java compile as we discussed before.

113
00:03:39,000 --> 00:03:41,000
So we need both.

114
00:03:41,000 --> 00:03:44,000
We need Java to run the application, we need Java C

115
00:03:44,000 --> 00:03:47,000
to compile the code, right?

116
00:03:47,000 --> 00:03:47,000
Okay, cool.

117
00:03:47,000 --> 00:03:48,000
So we got the number as well,

118
00:03:48,000 --> 00:03:50,000
I will just minimize this a bit.

119
00:03:50,000 --> 00:03:53,000
Okay, so now let's create our first file.

120
00:03:53,000 --> 00:03:55,000
So what we are going to do is we'll click on this particular

121
00:03:55,000 --> 00:04:00,000
file here and we'll name this as hello.java.

122
00:04:00,000 --> 00:04:01,000
Now there is something you have to remember,

123
00:04:01,000 --> 00:04:03,000
whenever you create a Java project, you have to make sure

124
00:04:03,000 --> 00:04:05,000
that you give an extension or Java files.

125
00:04:05,000 --> 00:04:08,000
Basically you have to give an extension with dot Java.

126
00:04:08,000 --> 00:04:10,000
Now different languages have different extension.

127
00:04:10,000 --> 00:04:13,000
When you talk about C, we say dot C,

128
00:04:13,000 --> 00:04:16,000
when you say C plus plus language, we say dot CPP.

129
00:04:16,000 --> 00:04:18,000
When you say Java script, we use dot JS.

130
00:04:18,000 --> 00:04:19,000
In the same way,

131
00:04:19,000 --> 00:04:22,000
in Java we say.java, simple stuff, right?

132
00:04:22,000 --> 00:04:24,000
So you've got our file here.

133
00:04:24,000 --> 00:04:26,000
Now VS code will give you some suggestions.

134
00:04:26,000 --> 00:04:28,000
We'll ask you to install some extensions for Java

135
00:04:28,000 --> 00:04:30,000
and we'll click on recommendation.

136
00:04:30,000 --> 00:04:32,000
Okay, it is asking us extension pack for Java,

137
00:04:32,000 --> 00:04:35,000
which will help us,

138
00:04:35,000 --> 00:04:37,000
it will give you some options and extra stuff.

139
00:04:37,000 --> 00:04:40,000
Again, this is just an advantage which you get from VS

140
00:04:40,000 --> 00:04:41,000
code, again, not required.

141
00:04:41,000 --> 00:04:42,000
If you don't want to install this extension,

142
00:04:42,000 --> 00:04:44,000
I think I should go for it.

143
00:04:44,000 --> 00:04:47,000
We also have intelli code for AI assistance.

144
00:04:47,000 --> 00:04:50,000
But yeah, we'll stick to this extension.

145
00:04:50,000 --> 00:04:51,000
Again, in your machine, you don't have

146
00:04:51,000 --> 00:04:53,000
to install this, there's no compulsion.

147
00:04:53,000 --> 00:04:54,000
You can still write your Java code,

148
00:04:54,000 --> 00:04:56,000
but maybe it will give you some

149
00:04:56,000 --> 00:04:58,000
suggestions and stuff in between.

150
00:04:58,000 --> 00:05:01,000
Let's see, let's close this and let's write our code.

151
00:05:01,000 --> 00:05:03,000
So extension will be installing behind the scene.

152
00:05:03,000 --> 00:05:04,000
You don't have to worry about it.

153
00:05:04,000 --> 00:05:06,000
So basically how do we write our Java code?

154
00:05:06,000 --> 00:05:08,000
It's very simple actually.

155
00:05:08,000 --> 00:05:09,000
First of all, the question is

156
00:05:09,000 --> 00:05:10,000
what do you wanna do in this code?

157
00:05:10,000 --> 00:05:13,000
Do you want to create a game

158
00:05:13,000 --> 00:05:17,000
or do you want to build a rocket which will go to mass?

159
00:05:17,000 --> 00:05:18,000
I'll not be doing those extra stuff.

160
00:05:18,000 --> 00:05:22,000
What I will do now is I will create a very simple file which

161
00:05:22,000 --> 00:05:23,000
will print hello world.

162
00:05:23,000 --> 00:05:25,000
I know, that's how you start a programming language, right?

163
00:05:25,000 --> 00:05:27,000
It is irrespective of which language you're learning,

164
00:05:27,000 --> 00:05:29,000
the first thing you do is you print hello world.

165
00:05:29,000 --> 00:05:31,000
So here I want to print hello world.

166
00:05:31,000 --> 00:05:32,000
Now how do we do that?

167
00:05:32,000 --> 00:05:35,000
See if you, in case if you are coming from other languages,

168
00:05:35,000 --> 00:05:37,000
let's say Python, right?

169
00:05:37,000 --> 00:05:39,000
So what you do is if you want

170
00:05:39,000 --> 00:05:41,000
to print hello world in Python, you can write only one line

171
00:05:41,000 --> 00:05:44,000
and maybe Java is not that famous

172
00:05:44,000 --> 00:05:46,000
for simplicity at the start.

173
00:05:46,000 --> 00:05:48,000
Of course when you build a bigger project,

174
00:05:48,000 --> 00:05:51,000
Java is much more structured compared to the languages.

175
00:05:51,000 --> 00:05:53,000
But then to start with, it's not that easy.

176
00:05:53,000 --> 00:05:55,000
So just bear with me.

177
00:05:55,000 --> 00:05:57,000
So what we are gonna do now is

178
00:05:57,000 --> 00:05:59,000
if you want to just experiment

179
00:05:59,000 --> 00:06:02,000
with Java, if you want to play some, if you want

180
00:06:02,000 --> 00:06:03,000
to test some code or stuff,

181
00:06:03,000 --> 00:06:07,000
we have an option which was introduced in Java nine.

182
00:06:07,000 --> 00:06:09,000
So basically you can write your code, in one line

183
00:06:09,000 --> 00:06:11,000
you can get the output example.

184
00:06:11,000 --> 00:06:12,000
So even before we jump to hello

185
00:06:12,000 --> 00:06:14,000
world, let me show you something.

186
00:06:14,000 --> 00:06:17,000
So we have a op, we have a concept of J shell in Java.

187
00:06:17,000 --> 00:06:19,000
So it was introduced in Java nine as I mentioned.

188
00:06:19,000 --> 00:06:20,000
So you can open your terminal

189
00:06:20,000 --> 00:06:23,000
and here let me just increase the size a bit.

190
00:06:23,000 --> 00:06:26,000
So what I will do is I will click on J shell

191
00:06:26,000 --> 00:06:28,000
or I will type J shell and it will give you a

192
00:06:28,000 --> 00:06:30,000
J shell prompt.

193
00:06:30,000 --> 00:06:32,000
Now J in this case is Java.

194
00:06:32,000 --> 00:06:33,000
So you can it make, it should make sense now, okay?

195
00:06:33,000 --> 00:06:36,000
So what you can do in Jshell is if you want

196
00:06:36,000 --> 00:06:38,000
to experiment something, example, why do we write code?

197
00:06:38,000 --> 00:06:39,000
Why do we build application?

198
00:06:39,000 --> 00:06:41,000
So to solve problems right, now it can be a

199
00:06:41,000 --> 00:06:42,000
very simple problem as well.

200
00:06:42,000 --> 00:06:45,000
Example, if you want to add two numbers, it's very simple.

201
00:06:45,000 --> 00:06:47,000
You can say two plus three.

202
00:06:47,000 --> 00:06:49,000
And if I say enter, you can say we got five, right?

203
00:06:49,000 --> 00:06:51,000
So we got the answer which is five, what if you want

204
00:06:51,000 --> 00:06:53,000
to do a subtraction, you can do that.

205
00:06:53,000 --> 00:06:56,000
So nine minus six, and you can see we got three.

206
00:06:56,000 --> 00:06:58,000
So this is working, but what if you want to print something?

207
00:06:58,000 --> 00:07:01,000
So in this case what you can do is when you were in Java,

208
00:07:01,000 --> 00:07:02,000
if you want to do something,

209
00:07:02,000 --> 00:07:04,000
we use something called methods.

210
00:07:04,000 --> 00:07:06,000
At this point, you don't have to remember methods on

211
00:07:06,000 --> 00:07:07,000
what the definition is.

212
00:07:07,000 --> 00:07:09,000
Just remember that there's a concept called methods

213
00:07:09,000 --> 00:07:11,000
using which you can do something.

214
00:07:11,000 --> 00:07:12,000
The only thing you have to remember is if you want

215
00:07:12,000 --> 00:07:14,000
to do something, you need methods.

216
00:07:14,000 --> 00:07:16,000
In the same way, if you want to do something here,

217
00:07:16,000 --> 00:07:17,000
I want to print something, right?

218
00:07:17,000 --> 00:07:20,000
So we have to use a method called print.

219
00:07:20,000 --> 00:07:22,000
It is a inbuilt method in Java so you don't have

220
00:07:22,000 --> 00:07:24,000
to worry about it, just use it, it will work.

221
00:07:24,000 --> 00:07:28,000
So whenever you call methods, you have to parse the values.

222
00:07:28,000 --> 00:07:30,000
So I want to say, hey print,

223
00:07:30,000 --> 00:07:31,000
but then it will say okay, I will print,

224
00:07:31,000 --> 00:07:33,000
but what you want me to print?

225
00:07:33,000 --> 00:07:35,000
So you can mention that in this bracket.

226
00:07:35,000 --> 00:07:37,000
So in this round brackets, you can mention I want

227
00:07:37,000 --> 00:07:38,000
to print hello world.

228
00:07:38,000 --> 00:07:40,000
Now if you want to just print a number,

229
00:07:40,000 --> 00:07:41,000
let's start with that first.

230
00:07:41,000 --> 00:07:44,000
So let me just print a number, which is six.

231
00:07:44,000 --> 00:07:45,000
And in Java there's one more thing.

232
00:07:45,000 --> 00:07:47,000
You have to put a semicolon at the

233
00:07:47,000 --> 00:07:48,000
end, it should work in this.

234
00:07:48,000 --> 00:07:51,000
But then living with this, at the end put a semicolon.

235
00:07:51,000 --> 00:07:54,000
That's how you mentioned, hey, something is getting ended.

236
00:07:54,000 --> 00:07:55,000
So we've got a semicolon there.

237
00:07:55,000 --> 00:08:00,000
And now what you can do is let's try to run this code.

238
00:08:00,000 --> 00:08:01,000
Now errors, right?

239
00:08:01,000 --> 00:08:02,000
Error are very important in your life,

240
00:08:02,000 --> 00:08:03,000
in your programming life,

241
00:08:03,000 --> 00:08:04,000
basically you see you got the error.

242
00:08:04,000 --> 00:08:08,000
It says cannot find a simple call print, it's not working.

243
00:08:08,000 --> 00:08:09,000
Okay, cool, no problem.

244
00:08:09,000 --> 00:08:11,000
So let me just clear the screen.

245
00:08:11,000 --> 00:08:13,000
A clear comment is not working, ignore that.

246
00:08:13,000 --> 00:08:15,000
So let me open Jshell once again and let's,

247
00:08:15,000 --> 00:08:17,000
because I just want to keep it on top.

248
00:08:17,000 --> 00:08:19,000
So what I will do now is if I want to print something

249
00:08:19,000 --> 00:08:23,000
and I want to print a value six at the end,

250
00:08:23,000 --> 00:08:25,000
I want a semi colon as well.

251
00:08:25,000 --> 00:08:27,000
Now Java says if you want to call print,

252
00:08:27,000 --> 00:08:29,000
print belongs to something, right?

253
00:08:29,000 --> 00:08:31,000
So it it when I say it is available inside Java.

254
00:08:31,000 --> 00:08:33,000
So the statement you have

255
00:08:33,000 --> 00:08:36,000
to always mention is system.out.print again.

256
00:08:36,000 --> 00:08:38,000
See there will be a point where you, I will, will talk about

257
00:08:38,000 --> 00:08:40,000
what is system, what is out.

258
00:08:40,000 --> 00:08:41,000
At this point it's very difficult to understand.

259
00:08:41,000 --> 00:08:43,000
So just bear with me.

260
00:08:43,000 --> 00:08:45,000
This is a statement which you have

261
00:08:45,000 --> 00:08:49,000
to use if you want to print something on the console.

262
00:08:49,000 --> 00:08:51,000
So if I want to print something here,

263
00:08:51,000 --> 00:08:53,000
just say system.out.print

264
00:08:53,000 --> 00:08:56,000
and whatever value you want to pass, say enter.

265
00:08:56,000 --> 00:08:57,000
You can say we got six,

266
00:08:57,000 --> 00:08:59,000
but what if you want to print hello world,

267
00:08:59,000 --> 00:09:01,000
I don't want to print six.

268
00:09:01,000 --> 00:09:03,000
So if you want to repeat the same statement,

269
00:09:03,000 --> 00:09:06,000
of course you can type or you can click on the up arrow,

270
00:09:06,000 --> 00:09:07,000
it will give you the option.

271
00:09:07,000 --> 00:09:09,000
Now here if you want to print hello world, you have to put

272
00:09:09,000 --> 00:09:10,000
that in double codes.

273
00:09:10,000 --> 00:09:13,000
So whenever you want to do something with text,

274
00:09:13,000 --> 00:09:16,000
see numbers are easy to use, you can simply say six.

275
00:09:16,000 --> 00:09:19,000
But if you want to work with a text, you have to put

276
00:09:19,000 --> 00:09:21,000
that in double codes the way I've done it here.

277
00:09:21,000 --> 00:09:22,000
So in this double codes you have

278
00:09:22,000 --> 00:09:24,000
to mention hello world, right?

279
00:09:24,000 --> 00:09:26,000
That's how you start a programming,

280
00:09:26,000 --> 00:09:27,000
programming journey, right?

281
00:09:27,000 --> 00:09:29,000
I will say enter and you can say we got hello world,

282
00:09:29,000 --> 00:09:30,000
what if I want to print something

283
00:09:30,000 --> 00:09:32,000
else, which is very simple.

284
00:09:32,000 --> 00:09:35,000
You can say double codes, not being ready, Telusko.

285
00:09:35,000 --> 00:09:37,000
And if I say enter, you can say we got the text.

286
00:09:37,000 --> 00:09:40,000
So whatever you want to print, just put that in double codes

287
00:09:40,000 --> 00:09:41,000
and it should work.

288
00:09:41,000 --> 00:09:44,000
And you can see we are getting the output as well, so cool.

289
00:09:44,000 --> 00:09:47,000
So we are able to do this with the help of J shell,

290
00:09:47,000 --> 00:09:49,000
but will it work in this?

291
00:09:49,000 --> 00:09:51,000
If I try to copy this, in fact why

292
00:09:51,000 --> 00:09:53,000
to copy it, we can type it.

293
00:09:53,000 --> 00:09:57,000
So let's type system.out.print.ln,

294
00:09:57,000 --> 00:10:00,000
and here we'll say hello world

295
00:10:00,000 --> 00:10:01,000
and let's give a semi colon

296
00:10:01,000 --> 00:10:04,000
at the end, it was working on J shell.

297
00:10:04,000 --> 00:10:06,000
But when you work with Java files,

298
00:10:06,000 --> 00:10:07,000
because this is how you build a project, right?

299
00:10:07,000 --> 00:10:09,000
J shell is not to build projects,

300
00:10:09,000 --> 00:10:10,000
it's just for the experiment.

301
00:10:10,000 --> 00:10:12,000
If you are learning a language, it is good,

302
00:10:12,000 --> 00:10:15,000
but if you want to build a big application,

303
00:10:15,000 --> 00:10:16,000
say dot java file and write your code there.

304
00:10:16,000 --> 00:10:17,000
So let's compile this code.

305
00:10:17,000 --> 00:10:18,000
Now how do we compile?

306
00:10:18,000 --> 00:10:20,000
Okay, so there, there are two steps you have to follow.

307
00:10:20,000 --> 00:10:23,000
First, when you write a code, you have to compile the code

308
00:10:23,000 --> 00:10:24,000
and then you can run the code.

309
00:10:24,000 --> 00:10:27,000
So to compile the code, you can say Java C in the terminal,

310
00:10:27,000 --> 00:10:29,000
and let me just increase the font a bit.

311
00:10:29,000 --> 00:10:31,000
So you have to say Java C

312
00:10:31,000 --> 00:10:32,000
and then you have to mention the file name.

313
00:10:32,000 --> 00:10:33,000
So first you have to be make sure

314
00:10:33,000 --> 00:10:36,000
that you are in a correct folder, which is close.

315
00:10:36,000 --> 00:10:38,000
You can see that this is a folder we have

316
00:10:38,000 --> 00:10:39,000
and then you have to mention Java C.

317
00:10:39,000 --> 00:10:40,000
And then the file name.

318
00:10:40,000 --> 00:10:44,000
The file name in this case is hello.Java, click on enter.

319
00:10:44,000 --> 00:10:46,000
Oh, we got an error.

320
00:10:46,000 --> 00:10:48,000
Okay, so it says something is missing, you know,

321
00:10:48,000 --> 00:10:50,000
something else was expected

322
00:10:50,000 --> 00:10:53,000
and you are giving this, this is not working.

323
00:10:53,000 --> 00:10:55,000
So this is not how you write applications

324
00:10:55,000 --> 00:10:56,000
or code in Java file.

325
00:10:56,000 --> 00:10:58,000
We have to do something else.

326
00:10:58,000 --> 00:10:59,000
But at this point we have understood right?

327
00:10:59,000 --> 00:11:00,000
How do you work with Jshell?

328
00:11:00,000 --> 00:11:01,000
So you can, if you want to do something with Jshell,

329
00:11:01,000 --> 00:11:04,000
just write a code, it will work.

330
00:11:04,000 --> 00:11:05,000
If you want to add two numbers, it will work.

331
00:11:05,000 --> 00:11:06,000
You can't do that here.

332
00:11:06,000 --> 00:11:10,000
We have to do something extra, and what is that something,

333
00:11:10,000 --> 00:11:12,000
that we'll see in the next video.