spring-5-with-spring-boot-2 / 02 - Core Java /004 First code in Java_en.srt
Tan115's picture
Add files using upload-large-folder tool
78b4844 verified
Raw
History Blame Contribute Delete
24.6 kB
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.