Curso de Java #02 - Como Funciona o Java - Gustavo Guanabara

1.09M views3519 WordsCopy TextShare
Curso em Vídeo
Aula completa em http://www.cursoemvideo.com/lesson/funcionamento-java-curso-de-java/ Como funciona...
Video Transcript:
♫ ♫ Soundtrack Hello! Welcome to another lesson of their course of Java! My name is Gustavo Guanabara, I am your teacher and after, the first class, we see the history of Java, You will, in this second part, see the following: How does the Java language.
I remember very well, in the last class, one of the last things I said was Java is different. But first, let's remembered what we have seen . .
. One of the things we talked last class was on the C language and we saw that it is multiplatform. This, for example, is a C language code to write "Hello World!
" on the screen and we also saw in the last class, that is called Source Code. If we take this source code, and send directly to your computer he will not understand So that he can understand, we'll need to convert it using a special program called compiler. We will send this Source code for the compiler and it will generate me a code called executable code containing micro machine instructions, responsible for running this program.
If I get this executable code and place on your computer he will understand and perform correctly. This we saw last class. We also saw that the C language is considered multiplatform let's review a little bit more about it.
You must remember very well, you could have multiple platforms for example: "DOS", "MAC" and "LINUX". And I would have to have a compiler for each of them. For this C program works on all platforms I have to get this source code, with minor changes send to each of the compilers and each would generate its own executable.
Each executable can only be submitted to the platform which it relates. So for example, if I build a C program on the Mac, it will only work on Macs If I compile this program in C, in linux, it will only work on Linux Taking these source codes by sending pros computers they understand and would perform correctly beauty? it was clear?
So it is multiplatform C but it relies on a pre build in each of the languages and as I said earlier, java is different. Let us consider the same environment, only this time with the code in Java. This, for example, is a code to write "hello world" on the screen and then, right away, many people will speak our this program was much larger, the controls are very large then Java is very difficult.
Calm! No despair, a lot of people criticizing these great commands java but all this has its meaning, all this has its reason then this is considered the source code in Java. Similarly, if I get this source and send to the computer, it will not understand.
Then, to this point, Java works the same way C. Then, following the same line of reasoning I'll need a special program called Java compiler which in our case here, we will call "javac" or "Java Compiler" And, sure, you've done some online course or your own teacher's college or university He called it Javaqui (javac). Particularly, I think I think it looks more javaqui those brands of soap intimo but, speaking of right is "Java C" (in English) but I will speak "Java C" in Portuguese it.
I will not call Javaqui a matter, right ! ? Folks.
I prefer to speak "Java C" Like any good old compiler, it will get this source code and will generate a binary coded The code generated by Java, we do not call executable code, we call "bytecode" And then begins the first difference the code generated by a Java compiler is not executable code and there you may think, put Guanabara, it's just a freshness, a matter of name . . .
Calm! you will already understand, little grasshopper The main difference is that if I get this bytecode and send to the computer, it also will not understand And then you might ask? Pera there, C is better, because in C I generate the source code mando pro compiler and the result of it is already executable Java does not, then it is worse .
. . Calm!
Let us reason Let's get this same environment, that is, the source code We passed by Javac generating bytecode. As we have seen, if I get this bytecode and sending to your computer even it being Windows, you see there? The compiler and the computer are the same platform, Windows even so, the bytecode will not be understood This is because I need another intermediate Software I'll represent here as a coffee maker.
Java Coffee . . .
. . .
machine . . .
For this structure, I can already submit her name is Java Virtual Machine or Java virtual machine. This Java Virtual Machine is best known by its acronym, JVM. If I get this bytecode and send directly to JVM it will interpret this code and generate necessary code to machine so she can understand And then the program will run So, in your mind you may be going through a lot of stuff but a question goes on everyone's mind pear there, why Java is so sensational so if he needs more software in the middle which is the JVM and now comes the cat jump (Meow Cat in the background).
Let's consider, that hypothetical environment class 1 that has three different platforms: Windows, Mac and Linux. There are JVMs for Windows, Mac and JVMs for Linux to and they are virtual machines distributed by Oracle. You, the programmer, will not need to move them.
They are already prepared to execute any code in its related platform and then, thinking this way, look at the simplicity . . .
I get the source code in Java, command for Javac which will generate bytecode me that we already know. This bytecode was compiled on a Windows machine notice up there at Javac icon And then coming to the Sun masterstroke at the time, and Oracle today Did you notice that I have compiled the source code on a Windows compiler it generated a bytecode for Windows? No!
It is a bytecode. If I get the same bytecode and send to the three JVMs they will talk to their respective operating systems and they will all understand the same bytecode. It was clear?
That's legal. I compile once and it works on any platform. So I can take any source code in Java send to a compiler on any platform and it will generate me that bytecode.
This bytecode generated by the compiler will be able to be sent to any virtual machine and here I speak of Windows, Mac, Linux even mobile devices like cell phones and smart watches. You realize that you developed something in Java, a platform and it will work on multiple platforms ! ?
For there is a name for it. In fact it is more than a name is an acronym that is WORA WORA is an acronym for "Write Once Run Anywhere," which in Portuguese would "Write once, run anywhere" And this is the great advantage of Java, "Write Once Run Anywhere" is write once, compile once and put it to work on any platform that has a JVM. He gave to understand the beauty, the simplicity of this Java platform?
So then, everything we saw last class evolution, the emergence of language "Oak" to generate the "Seven Star", which was a project that came to nothing and then gave rise to the "Web Runner" that Tim Berners-Lee, with his invention, facilitated the use of browsers and there came the "Hot Java" which was a browser giving rise to the Java language and that is there face! This is the great advantage of Java you will write your code once and will run on either platform. This is the great simplicity of Java.
Java is not an easy language, Java is a very complete language. So, it is very difficult for someone to come to you and talk like this: If someone comes to you and to say: 'Oh! But I already know all of Java!
Impossible for a person to know all of Java. It is a very complex language, but at the same time has its simplicity Then, the operation of Java is very simple but learning it requires much study, dedication his and that is where you will begin your studies and so far we have seen some acronyms such as Javac, JVM, WORA. In fact, the Java platform is a large alphabet soup and you will have to learn some acronyms before that class ended.
The first thing you will have to understand that is there are two stages in the development of Java. You should understand that there are Java programmers and there are people who use only Java and these two types of users are separated by the Java platform Two groups that we have to understand. Who just want to use Java, will use the JRE.
Who wants to develop for Java will use the JDK. Javac, JVM, JRE, JDK . .
. I began to complicate? Calm!
If you roll a bit to learn these abbreviations this class is not to be seen at once, watch a couple, three times for you to internalize, so you can quite understand how it works But let's see the translation of these acronyms and I guarantee you will understand correctly. The JRE acronym is an acronym for "Java Runtime Environment" or Java runtime environment. JDK means "Java Development Kit" or Java Development Kit.
Then, speaking in Portuguese, it becomes easier. Who wants to use Java, will use a Java runtime environment will only run Java programs. Have for those who want to program, you need a Java Development Kit.
JRE JDK JRE, only execution, JDK development as we are in the course of development, we will need the JDK but you'll have to understand what is the JRE The JRE is simple and consists of two parts: the JVM and libraries. The JVM you already know what is It is the Java Virtual Machine is one machine that will make the code bytecode is sent to the computer. Libraries are APIs that you will be able to use within your program and make it more attractive and more functionality.
The JVM has some internal parts, you have to know superficially as, for instance, "loader", and the verifier. The "loader" is the inside of the JVM that will load the bytecode in memory of your virtual machine. The verifier will check whether the code can be executed without any problems.
In addition, we have the interpreter and the memory manager. The interpreter is the one who will take the code in bytecode and directly transform pro native machine code in question. So for example, if I'm on the JVM for Windows it will convert the bytecode instruction code in Windows will understand.
The memory manager will treat as the codes and variables will be managed in the JVM memory. Recalling that the JVM is like a virtual computer, then it has a memory then the memory manager is not memory manager from your computer but your JVM We have within the JVM also a "JIT" compiler. "JIT" is an acronym for "Just In Time" we could translate into real-time translation I will not delve much this conversation not.
If you want more information about the "JIT" Search here: Java "JIT", you will understand. The "JIT" compiler, in general, is the following . .
. The Java virtual machine is so smart today she can see which parts of the code are more important into your program takes this code and compiles already definitely within the bytecode. So, I will not need to use the Java interpreter for that part of the "JIT" compiler considered as important.
Confused? You do not need to understand this very well. The important thing is that you understand that the compiler "Just In Time" It appeared to give a big performance gain because there were a lot of criticism.
Look . . .
Like I told you . . .
If I get the C and generate an executable code, it is already executable on the computer If I generate it in java, I can not run directly on the computer I will need another layer of software that is the JVM. So I'll need an extra layer. So people criticize saying that Java is slower and everything.
So you can have a performance boost and stop this theoretical slow JVM . . .
Formerly the JVM was much slower nowadays you do not even notice much difference. But the fact is that the "Just In Time" compiler came to make this easier and give a performance gain. So this is the basic composition of the "JRE".
Within the "JVM" there are other components I just exemplified these five there are: the Loader, the Scanner, the interpreter, the memory manager, the compiler "JIT" which are, in my view, the most important. The "JDK" is much more complete than the "JRE" To begin with, in the "JDK" already has the "JRE" that is, it comes with the JVM with all these components that you see there on the right and libraries. In addition, it comes with the Java language, which we call "JavaLang" and comes with a set of tools that we call "JavaTools" So right away, within the "JDK" already has the "JRE" already has the "Runtime Environment".
Of course! because the time you do the program, you will want to run it So basically, if you already install "JDK" comes the "JRE" you do not need to install the "JRE" "Oh no, I want to program is" JDK "I want to run is" JRE "" So I need to install both if I want to set? No!
, you just install the "JDK" that it already comes with the "JRE". Within the "JavaTools" there are several tools, I will cite just a few. First, you have heard, it is the "javac".
Javac is the Java compiler. It is one that will transform the source code into bytecode. We also have the group of "JavaTools", the "Debugger" that will allow you to check how your program is running in real time including checking and testing content variables or access to the database.
The third and last I'll mention are the "APIs". In Java, nowadays, they are distributed several "APIs" and these are "APIs" development. You will then have, for example, the "JavaFX" which is a group of new mega libraries that they are included in the "JDK" Then you will have several "APIs".
There are other things in the "JDK" but this is an overview. And then, most courses around I'll still bring an extra for you. Time to install the "JDK", you can also install a "IDE" it does not come within the JDK, but it can be attached to it.
"IDE" is a development environment that will greatly facilitate time for you to program in java. So basically, when you are learning Java in your college, in your college or a tutorial on youtube, you stop there you install the "JDK" tests the "javac", tests the interpreter, Java performs, is a black screen, is awful and you do not have a facilitation time to enter. I'll show you how to develop using an "IDE" and I chose to be part of this course It is the one officially distributed by Oracle which is the "Netbeans".
I also know that in your college you probably used the "Eclipse" or you see a tutorial on youtube that is using the "Eclipse". Great! You will learn on another platform.
The platform that I like, that I use and that I teach is the "Netbeans". So that's the overview of Java development. Just to recap quickly, if you will just use Java, you install the "JRE".
For example, you will use the "JDK" to create the application, will make the cute application will generate a distribution version and will deliver this distribution version, your bytecode to your customer. Your client will need the "JRE" because it will need to run this bytecode. For you will learn, from now on, to develop in Java, you will need to download the "JDK".
Ufa! It's very acronym huh ! ?
"JVM" "JDK" "JRE" "JAVAC", "IDE". Damn it! It may seem very complex, but in the end is simple.
You just get used to. Again I say, you have a wonderful resource in your hand is the replay. So you finished watching this class?
He was a little confused? or even understood almost complete? Attends class again, trust me.
You need to understand these acronyms. And do not think that end there not because the lesson that comes comes more acronym, because you will have to understand which version of "JDK" you'll have to download. There is the "SE", the "EE", the "ME", the "TV" .
. . a series.
And then you'll have to understand how it all works together, which package you'll have to download. As you will have to access it, but that only the next class Where you will understand what package you'll have to download download the correct package and properly install it on your platform. I hope you enjoyed this lesson, it is a very reasonable technical content.
Maybe we have even a little less time, but the content was too large. So I'll cut through here. You will, in the next class, see how to install the "JDK".
We will install the "JDK" the platform "SE". You will understand to serving the "SE" platform. The documentation will show you how to get help to install and how does it work cute and correct.
And take the final preparatory step so we can begin laying the hands on the same and create our first program in Java. But it is not the same as internet course not -Oh! I will not need to know the history of the internet not.
You can not skip anything in the course of Java. If you skipped the first lesson - Oh no! It's just history, I will not watch.
Back there, because it has a knowledge you need the platform of the thing, how languages ​​for you to understand because then the worst part of java is when you do not understand how it works and you find it difficult, because people have a tendency find that java is difficult Oh! the controls are very large, it is very difficult No! everything has its purpose, everything has its reason but for this you have to take the step by step So if you skipped the first class back now, watching her again, before again watching this second class because it has a series of markings, has a number of concepts you, little grasshopper, you need to understand.
So I take my leave here, we'll see you next class where you will understand how to install the correct platform so that we can develop applications for our operating system. I hope you're sharing, enjoying showing to people that course. Look, you do not know anything about Java?
Are you up for? He took a beating in college? Face!
I'll try to make it all becomes very simple for you. I have many students in college, I have students in preparatory they talk like this: -Puxa! I had class before, Java, but I had this whole base and I found it hard now I find it easy.
So trust me, I guarantee you will learn Java. What I wanted to ask is the usual. ← Here ye!
Forms part of the channel Here, whenever you have a new class. Next week has a new class? you are watching more forward, the course is complete!
Will direct you to the next class ← O Sign here! Because when you leave new course, you will be warned Click here → You will have access to all classes all classes will be organized here And here in the middle ↖ The complete experience, cursoemvideo. com There you will get all the links.
For now these first classes do not have much link is more concept but whenever you need a link, download a package, download the "JDK" will be all organizadinho Here ye! ↖ www. cursoemvideo.
com And it is only here ↖ That, after watching all classes, you are entitled to print a certificate. So is there a piece of cake right! You will make a good course will train hard and will learn real Java and you will still get a certificate saying you know It is only ongoing video that gives it, right this?
So you help us, boot on Facebook: - Gee! Guys! O look here!
Look how the Java you have taken beating in college? not learned right? Learn here what is "JDK", which is "JRE" this whole thing.
And let's step by step the way you become a Java programmer. Again a hug. Study hard, little grasshopper!
Copyright © 2024. Made with ♥ in London by YTScribe.com