Prática de Shadowing: Learn Java in 14 Minutes (seriously) - Aprenda a falar inglês com vídeo

Criando lição...
1
If you're struggling in Java, don't worry because I got you.
2
Just take a nice deep breath, sit back, and I'm going to show you everything you need to know in Java.
3
This video is made so you can just watch it on your phone or follow along if you want.
4
I've been programming in Java for over 8 years now.
5
I graduated with a computer science degree, and maybe like you, I had a lot of problems learning how to program at all.
6
I had a breakdown in college when I thought I couldn't pass a few of the projects, so it was really hard for me hard for me but I don't want to make it hard for you.
7
I want to try to help you out wherever you are in your life with programming
8
and hopefully you find this video helpful.
9
This is everything you need to know about Java in 13 minutes.
10
Hey, it's Alex back again helping you learn Java.
11
On this channel if you're new here I make a Java tutorial just like this one every single week.
12
So if you're new here then consider subscribing.
13
Computers only understand zeros and ones which makes it kind of difficult for a human.
14
So to solve this what we did is we made programming languages
15
which are just a bunch of keywords and symbols that help us program a computer.
16
The one we're learning today is obviously Java and here's everything you need to know about Java to start getting started.
17
What you see on the screen now is a programming environment.
18
This is where you write code.
19
You can write code in notepad or on a piece of paper, but none of those ways has a way to compile your code which means turn it into zeros and ones.
20
There are a bunch of tutorials on how to install Eclipse.
21
This is the program Eclipse or IntelliJ is a good one.
22
I made a video of installing Eclipse on Mac and Windows.
23
It's on the screen now if you want to check that out.
24
We'll just set up a file to start learning Java.
25
So I'm just going to go to File, New Java Project.
26
Type in the project name like Java Tutorial Epicness.
27
Hit Finish.
28
Next expand that up.
29
Right click on the source folder and go to New Class.
30
And this is just our Java file name our Java file like learn Java.
31
Hit this first check mark, public static void main, and then hit finish.
32
And we get some code looking stuff pop up on the screen.
33
So like I said, a programming language is just a bunch of keywords and symbols, and it looks like this Java file already has some keywords and symbols in here for us.
34
A super useful thing we can do in Java is store data.
35
So you can store, say, a number variable in Java by doing this int a equals say 5.
36
This takes the value of 5 and stores it into a.
37
You'll notice this keyword int that stands for integer
38
and there are a bunch of other ones like I'm just going to list a few.
39
So here's a few more.
40
There's one called char, long, and double.
41
Char stands for character so this is how you would store a character variable.
42
You would just put your character inside of single quotes and that would be stored into b.
43
You get a few others like long, double, and there are a bunch more.
44
These are called primitive types since they turn purple.
45
Like how primates are before humans, the word primary means number one.
46
Primitive just means it was here before.
47
It's built into Java, which is pretty sweet.
48
Let's go on to non-primitive types of storing data because storing data is super cool.
49
If we wanted to change our username, say on Instagram, it's got to store it somehow, right?
50
So to store like a name, like a bunch of character variables, that would be called string with a capital S there.
51
I'll name it like string name and set that equal to Susan and then put a semicolon at the end.
52
Most statements will end in a semicolon, by the way.
53
These don't for their own reasons, but if it doesn't have some sort of parenthesis at the end, put a semicolon there.
54
All these symbols help Java parse it, which just means go through and make sense of it all.
55
So that's why these weird little semicolons exist.
56
So now the name Susan is stored into name, but notice how this isn't turning purple.
57
It's not a primitive type.
58
If it's not turning purple, That probably means it's an object.
59
And you can do so many things with objects, it's crazy.
60
To do crazy things with your object, we can just type the name of the string.
61
And in this case, it's name.
62
So we'll just type name.
63
You'll see red underlines pop up, don't worry about it, it's just trying to correct you before you make a mistake.
64
I think it's really stupid, because we're not done yet.
65
But after you have the name of your variable, hit a period.
66
And this period is maybe one of the most important symbols in Java, because it tells you everything that that variable can do for you.
67
All that wonderful code built into Java, you have it accessed through this period.
68
The programmer you're writing Java in will most likely have like a little box here
69
and you can scroll through it and this is everything you can do to that variable.
70
So one I like to pick right now would be like to uppercase.
71
So I can just double click on it
72
or you could type it out and then semi-colon since it's not opening a bracket.
73
Well, how do we see this working?
74
There's this great piece of code to print out So you can see things.
75
It's called system.op.println and then some parentheses.
76
We're pretty much just taking this and sticking it inside of the parentheses of this code.
77
This just puts it on the screen for us.
78
So I'm just going to control S or command S to save it.
79
And I'm going to run it.
80
And then in your console window, it might be called console, it might be called something else, but in a window, you should see your name to uppercase.
81
If you want to see something else, so we can just delete this, do the dot again to bring up what it can do, and there's one called to lowercase, save it again, run it again,
82
and now it's all to lowercase.
83
This to lowercase has some parentheses here, and this putting text to the console window code has some parentheses here too,
84
and anything that has parentheses like this is 99% of the time gonna be a method, and methods are amazing.
85
They're the bomb, because they just do things for you, like what we did now.
86
So let's make a method that puts an exclamation mark, say, at the end of whatever string you want.
87
To start a method, just write some keywords.
88
We're gonna write the keywords public static void.
89
Don't worry too much about this right now.
90
They're just keywords, and every keyword has its own purpose.
91
We'll name it like add exclamation point parentheses, say string s in here,
92
and then some curly braces to finish it off.
93
I'm just gonna delete these right now because it might look a little confusing.
94
All this method's gonna do is add an exclamation point to the end.
95
So we can just print out to the screen out like we did before, that's super useful.
96
To put two strings together, use a plus sign.
97
So in the parentheses, we'll just type S, which is the name of the string, plus an exclamation mark inside of double quotes.
98
Since characters and strings, Anything that's not a number or a variable name has to be in quotation marks.
99
Statements end in a semicolon.
100
We'll save it and run it, and nothing happens because we're not calling the method.
101
So we'll just type the name of the method and then something like hotdogs.
102
Now we can save it and run it, and we see hotdogs with an exclamation mark.
103
This right here goes here, and whatever's inside of these curly braces gets run.
104
You can also return the results as a variable.
105
So we can say return, which is another keyword, s plus the exclamation mark.
106
You get a red underline because this keyword, void, is actually the type of what you want to bring back.
107
So we just want to do a string,
108
and now we can say a string exclaim is equal to what's returned from add exclamation point.
109
It's stored in here, but let's print it out, and it does the same thing.
110
I said the dot could bring up a bunch of methods that you could use?
111
Well you can also call them without a dot if it's in the same Java file.
112
But now I'm going to show you how to use code from another Java file into your Java file.
113
So I'll just right click source again, make a new class, we'll call it like animal and hit finish.
114
I'll make a method just like we did before, say like I am dog, and all it does is return I am a dog.
115
If we want to use the I am dog method, we can just, I'm just going to save it, go in here, delete this code for now.
116
To call I am dog, we can just make an animal object like this, animal a equals new animal.
117
Anytime you're making an object, it's going to have this format.
118
And there are a million types of objects out there you can use.
119
But now we can just say a dot and it brings up what that object can do and look, im dog is here.
120
You can just click it and then store that into a string dog and then print out dog.
121
Save it and run it and now you see that im dog message being returned to the variable dog.
122
So a class is just a Java file that helps us make objects.
123
Examples of commonly used objects are ArrayList.
124
It has the same format as before, but you've got to put these little angle brackets.
125
But a lot of objects will not come in your code.
126
You have to bring them in.
127
So usually what you'll do is hover over it, and you'll see an import.
128
Click the import suggestion, and that'll generate this import keyword, followed by like a path to the ArrayList code.
129
This just means bring the ArrayList into our program so we can use it.
130
In ArrayList, you can do things like add, you can add a bunch of items, like this is how they store movies, or store a list of users.
131
You can replace set and all sorts of things.
132
So objects and methods are super powerful.
133
Each object has its own methods, and that's why Java is referred to as OOP, which is Object-Oriented Programming programming.
134
Each class represents an object which has its own methods, like this one says I am dog, and you can add as many as you want.
135
Now you might be asking, how do I make a method that does something actually cool?
136
Well, we can start another one.
137
We'll say void since we don't want to return anything.
138
You can do logic in Java.
139
One keyword is if.
140
This is called an if statement.
141
You would have a condition in here, say like true, and then it would run the code inside of here.
142
This is useful if you have something like a is equal to a 5.
143
If a, two equal signs.
144
If a is equal to zero, then run this code.
145
You can tack on another one.
146
Otherwise, if a is equal to one, then we want to run this code.
147
Otherwise, if it's something else completely, then run this code.
148
If else statements are super useful.
149
You can repeat code by doing a for loop, and a for loop format has the keyword for, some parentheses, and then a format that kind of looks like this.
150
In simple terms, this will repeat the code inside of here five times.
151
You can change it, changing this number, eight, it'll run this code eight times.
152
You can put a for loop inside of a for loop, which makes it really interesting, just gotta change this variable.
153
Now whatever's in here will be run 64 times, because it loops eight times and then another eight times inside.
154
You can repeat code until a certain condition is met by typing the keyword
155
while parentheses curly braces and say like while a is equal to five,
156
again print out high, it's actually say while a is less than 50, print high and then increment a by one each time.
157
That's what plus plus means.
158
Now let's just call doStuff so we can see what's going on.
159
Go into the main method, whatever's in the main method will get run when you click run.
160
So we'll just make our animal again, say a and then a period to bring out what we can do.
161
And now we can see our doStuff method.
162
If we run it, we'll see high print out a lot, and then it'll stop until it gets to 49.
163
Because it start at five, go up six, seven, eight, nine, all the way up until 50, and it'll stop.
164
Some other good logic ones are try catch.
165
So the keyword try, and then catch.
166
It'll try to run the code inside of here.
167
If something goes wrong, an exception is thrown.
168
An exception means just something went wrong with your program.
169
And if something went wrong with your program, then the code inside of here will get run.
170
Let's use other people's code and methods inside of ours.
171
We can do that through an API.
172
An API is pretty much just a long list of methods that you can use that were made from someone else.
173
Like Google, YouTube, Instagram, Twitter.
174
Most software companies have APIs that you can use and bring inside your program and do cool stuff.
175
And to use someone else's API, you pretty much go to their website, download this jar file.
176
You would right click on your project, go to properties, go to java build path,
177
add external jars, pop in the jar that you just downloaded, say like twitter api jar, hit apply, do an import statement just like this,
178
but for the name of that jar, and then you could use the code that they wrote in your program.
179
That's pretty much everything you need to know about java.
180
We went over primitive types, variables, storing data, objects, classes, methods, logic, like if-else statements, and also what a lot of the symbols meant.
181
So I really hope this helped you get started.
182
I'm very new at this.
183
I've been doing Java tutorials for a while, but like trying to do it all at once was a bit of a challenge for me, so I tried my best.
184
And of course, if you want more, I make a Java tutorial every week, and you can subscribe down below if you don't want to miss any.
185
So as always, you could be anywhere in the world, but you're here with me, and I really appreciate that so much.
186
I'll catch you in the next video.

Sobre esta lição

Você está praticando inglês com "Learn Java in 14 Minutes (seriously)" usando a técnica de Shadowing.

O que é a Técnica de Shadowing?

Shadowing é uma técnica de aprendizado de idiomas com base científica, originalmente desenvolvida para o treinamento de intérpretes profissionais. O método é simples, mas poderoso: você ouve áudio em inglês nativo e repete imediatamente em voz alta — como uma sombra seguindo o falante com 1-2 segundos de atraso. Pesquisas mostram melhora significativa na precisão da pronúncia, entonação, ritmo, sons conectados, compreensão auditiva e fluência na fala.

Técnica de shadowing: leia o guia completo passo a passo →