YTread Logo
YTread Logo

Learn Java in 14 Minutes (seriously)

Jun 07, 2021
If you're struggling with Java, don't worry because I've got you, just take a deep breath, sit back and I'll show you everything you need to know in Java. This video is made so you can watch it on your phone. or follow us if you want. I have been programming in Java for over eight years. I graduated in computer science and perhaps, like you, I had a lot of trouble

learn

ing to program. I had a nervous breakdown in college when I thought. I couldn't get through the projects, so it was very difficult for me, but I don't want to make it difficult for you.
learn java in 14 minutes seriously
I want to try to help you at any time in your life with programming and I hope you find this video useful. This is everything you need to know about Java in 13

minutes

. Hi, it's Alex again helping you

learn

Java on this channel. If you're new here, I do a Java tutorial like this every week, so if you're new here and consider subscribing, computers only understand zeros and ones, which makes it a little difficult for a human, so to figure this out , what we did was create programming languages ​​that are just a bunch of keywords and symbols that help us program a computer like the one we are on.
learn java in 14 minutes seriously

More Interesting Facts About,

learn java in 14 minutes seriously...

Learning today is obviously Java and here is everything you need to know about Java to get started. Well, what you see on the screen now is a programming environment. This is where you write the code. You can read the code on a notepad or a piece of paper, but nothing like that. those forms have a way of compiling your code, which means converting it into zeros and ones. There are plenty of tutorials on how to install eclipse. This is the eclipse or IntelliJ program. It's good. I made a video on how to install eclipse on Mac and Windows.
learn java in 14 minutes seriously
It's on the screen now, if you want to check it out, we're just going to set up a file to start learning Java, so I'm going to go introduce a new Java project type of project name, like Java; For a true epic, press finish. then expand that right click on the source folder and get a new class and this is just our

java

file so name our

java

file like learn java press this first check mark public static void main and then press finish and we get some code. appears on the screen, 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, dishes here for us.
learn java in 14 minutes seriously
One very useful thing that we can do in Java is stored data, so you can store, let's say, a numeric variable in Java by doing this, it's the same as say five, this takes the value of five and stores it in a. You will notice this keyword int which means integer and there are many others like it. to list a few here are a few more this one is called char long and double char means character this is how you would store a character variable you would just put your character in single quotes and it would be stored in 2b and you would get a few others like the double long and there are many more, these are called primitive types, as they turn purple, like primates were before humans, not the word primary means primitive number one, it just means it was here before it was integrated into Java , which is pretty good.
Let's continue with the non-primitive types of data storage because storing data is great if we wanted to change our username, let's say on Instagram you have a store in some form right, so storing as a name as a bunch of character variables that are they would call chain. with a capital S, donate as in the string name and set that equal to Susan and then put a semicolon at the end, most statements will end in a semicolon, by the way, these don't because your own reasons, but if you don't have some sort of parentheses at the end put a semicolon in there, all these symbols help Java parse it, which just means go through it and make sense of it all, which is why there are these weird little dots. and comma, now the name Susan is stored in name, but notice what this looks like. it doesn't turn purple, it's not a primitive type, if it doesn't turn purple that probably means it's an object and you can do so many things with objects that it's crazy to do crazy things with your object, we can just write the name of the string and in this case it is the name, so we will simply write the name.
You will see a popup underlined in red, don't worry, it's just trying to correct you before you make a mistake. I think it's really stupid because we're not done yet, but after you. make your variable name reach a dot and this dot is perhaps one of the most important symbols in Java because it tells you everything that variable can do for you, all that wonderful code built into Java, it should act as a test during this period. The programmer you're writing Java in will probably have a little box here and you'll be able to scroll through it and this is all you can do with that variable, so one I'd like to choose now would be uppercase so I can duplicate it. click on it or you can type it and then semicolon as it doesn't open a square bracket well, how do we see this working?
There is a great snippet of code to print so you can see things. It's called system, dot, dot, print line and something else. parentheses, we're just taking this and pasting it inside the parentheses of this code, this just puts it on the screen, so I'm just going to control S or command s to save it and then we'll run it. and then in your console window it could be called console it could be called something else but in a window you should see its name in all caps if I want to see something else we can just delete this do the dot again so it shows up what you can do and there's a lowercase call, save it again, run it again and now everything is in lowercase, this lowercase has some parentheses here and this code to put text in the console window also has some parentheses here and anything that has parentheses like this is the 99% of the time it will be a method and methods are amazing, they are the bomb because they just do things for you like we did now, so let's create a method that puts an exclamation point, let's say, at the end of any string with the that you want to start. method just write some keywords, we will write the keyword which is public static null, don't worry too much about this now, they are just keywords and each keyword has its own purpose, we will name it like add string s here and then some braces to finish.
I'm going to delete them right now because it might look a little confusing. All this method will do is add an exclamation point at the end so we can just print it to the screen like we did before, that's very useful for putting two strings together, use a plus sign, so in parentheses we'll just write s, which is the name of the string plus and an exclamation point enclosed in double quotes, since characters and strings, anything that is not a number or a variable name must be enclosed in quotes. The statements end in a semicolon, we'll save it and run it and nothing happens because we're not calling the method so we'll just type the method name and then something like hot dogs now we can save it and run it and we see hot dogs with the following formation mark, this here goes here and whatever is inside these curly braces gets rough, you can also return the results as a variable so we can say return, which is another s keyword plus the exclamation point, you'll get a red underline because this keyword void is actually the type of what you want to retrieve so we just want to make a string and now we can say a string exclaim is equal to what is returned by adding an exclamation point is stored here , but let's print it and it does the same thing.
Remember I said the point could show a bunch of methods you could use. You can also call them without a dot if it's in the same Java file, but now I'm going to show you how to use code from another Java file in your Java file, so I'll just right click on the source again to create a new class, we'll call it like animal and I'll press finish. create a method just like we did before, say I'm a dog and all it does is return I'm a dog, if we want to use the I'm a dog method, we can just save it, go in here and delete it. this code for now to call I'm dog, you can make an animal object like this animal equal to a new animal every time you make an object, it will be in this format and there are a million types of objects that you can use, but now we can just say a point and what that object can do appears and look, I'm a dog, it's here.
I can just click on it and then store it in a string Doug and then print the dog, save it and run it and now you see that. I am a dog message that is returned to the dog variable, so which class is just a Java file that helps us make objects examples of commonly used objects? Our ArrayList has the same format as before, but you have to put these little angle brackets, but there are a lot of objects. they won't come in your code, you have to bring them in, so usually what you'll do is hover over it and you'll see an import, click on the import hint and that will generate this import keyword followed by a path to the ArrayList.
Coding this just means bringing ArrayList into our program so we can use it as an ArrayList. You can do things like add, you can add a bunch of things like this, it's like they store movies or they store a list of users that you can replace and all kinds of things. of things, objects and methods are super powerful, each object has its own methods and that is why Java is known as oo P, which is object-oriented programming, each class represents an object that has its own methods, like this one that says I'm a dog and you can do it. add as many as you want now you might be wondering how can I create a method that does something really interesting.
We can start with another one that will say void since we don't want to return anything. You can do logic in Java. A key word is if. this is called an if statement, today you would have a condition here as true and then you would execute the code inside here. This is useful if you have something like a equals 5 if a has equal signs if a equals zero then run this code, add another; otherwise if a is equal to one then we want to run this code; otherwise, if it is something completely different, run this code.
If-else statements are very useful, you can repeat the code by doing a for loop and a for loop format has the keyword for some parentheses and then a format that looks like this in simple terms, this will repeat the code inside here 5 times, you can change it by changing this number 8, it will run this code eight times, we can put a for loop inside a for loop, which makes it really interesting, I just have to change this variable now, whatever is here will be executed sixty-four times because it is repeated eight times and then another eight times inside, you can repeat the code to a certain extent.
The condition is met by writing the keyword while the parentheses in braces say like wow a is equal to five can you print it hello actually let's see well a is less than 50 print high and then increment a by one each time that's what else it simply means call do stuff so we can see what's happening, go into the main method, everything in the main method will be executed when you click run, so we'll just make our animal say a again and then a dot for get what we can. do and now we can see our method of doing things, if we run it we will see a lot of high prints and then it will stop until it reaches 49 because it starts at five, it goes up six seven eight nine until it reaches 50 and I will stop some other good logic are try catch, so the keyword try and then catch will try to execute the code inside here if something goes wrong then an exception is thrown exception means something went wrong with your program and If something went wrong with your program then the code that will be executed will be executed. there is here.
Let's use other people's code and methods inside our own. We can do it through an API. An API is pretty much just a long list of methods you can use. made from someone else like Google YouTube Instagram Twitter most software companies have APIs that you can use and incorporate into your program and do cool things until you get someone else's API, you pretty much go to their website and download this jar file. You would right click on your project. go to properties go to java build path add external jar files in the file you just downloaded say like Twitter API jar press apply make an import statement like this but for the name of that file and then you could use the code that they wrote in their program, that's pretty much everything you need to know about Java, you went over the primitive types, the variables that store data, the objects, the classes, the methods, the logic, if not, and also what many of them mean. of these symbols, so I really hope this helped you get started.
I'm veryNew to this, I've been doing Java tutorials for a while, but trying to do it all at once was a challenge for me, so I did the best I could and of course if you want more, I do a Java tutorial every week and You can subscribe below if you don't want to miss any, just as you can always be anywhere in the world, but you are here with me and I really appreciate it a lot. I'll see you in the next video.

If you have any copyright issue, please Contact