- Podcasts
- The Java Developers Hub
- Java Programming for Beginners | Complete Introduction to Java
Java Programming for Beginners | Complete Introduction to Java
The Java Developers Hub
- December 3, 2026
- 59 min
- Episode 3
About this episodeAre you ready to start your journey into software development with Java? This episode introduces Java programming, one of the world's most…
- What Java programming is.
- The history and evolution of Java.
- Why Java remains relevant in 2026.
- Key features and advantages of Java.
- Understanding platform independence.
- The meaning of Write Once, Run Anywhere (WORA).
- Where Java is used in the software industry.
- Introduction to the Java Virtual Machine (JVM).
- Understanding JDK, JRE, and JVM.
- What to expect from the Java Full Course.
- Career opportunities available to Java developers.
- Complete beginners interested in programming.
- Students learning computer science and software engineering.
- Aspiring Java developers.
- Web and backend development enthusiasts.
- Developers interested in Android and enterprise application development.
- Anyone starting a software engineering career in 2026.
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
Java Programming for Beginners | Complete Introduction to Java
Yes, so let's start. Welcome back Coder Army. In our new series, we are going to start the core Java series from today. So for a long time, kids were waiting for the core Java series. And this series has come. But before this series, I want to give you two warnings. The first warning is that we will not understand the simple syntax of Java in this series. So if you want to quickly understand the syntax of Java and want to finish the series, then you can go to some other series. You can see some other Java playlist. There are many available. In this Java series, we will understand Java in depth. Look, my friend, 2026 is here. It's the age of AI. If you learn a language on the basis of syntax, then there will be no benefit. Your core knowledge will never be strong. And syntax can be easily written by any model like chat, GPD, cloud, if you forget any syntax. But in this series, we will understand the internal architecture of Java and its ins and outs. Once you understand Java internally, all the fundamentals of computer science will be clear. Why Java was created? Why did we add the features? How does everything work internally in Java? We will study everything in this and understand it in depth. What will you get from this? First of all, if you want to make an application in Java, or if you want to use a framework in Java, like Spring Boot, or if you want to make an app in Android, you will never face any problem in making that because you will have good internal knowledge of everything. You will be able to apply all your principles. And since we are going to use the first thought principle, So again, everything will be crystal clear to you. So this was the first warning. The second warning is very simple, which we say in every series, that you can't watch the series passively. You have to motivate yourself daily, you have to come daily, you have to watch a video, and whatever we do in the videos, the code we do, whatever theory parts we understand, we have to implement it after the video. If I give you some questions, you have to practice them. So you have to feel, you have to be actively involved. If you are thinking that you can only passively finish this series, then it won't be possible, right? So these are two warnings. If you are ready with these two warnings, you want to understand Java internally, understand it well, and you want to actively watch videos every day, implement things, then let's start together. Again, there is no need to say that this series will be beginner-friendly. We will go from absolute beginner to advanced and we will crystal clear all the concepts of Java. So, let's start with our first topic. Come on, let's see the introduction to Java. First of all, I have a question for you. Why did Java come? I mean, there must have been many languages before Java. And which languages were there before Java? There was C, there was C + + too, right? When all these languages existed, then what was the meaning of Java coming? Right? First of all, we have to answer this question. Because if we don't understand this question, we will never understand what role does Java play and how it is different from the other languages that came before it. Okay? So, let's understand this. It is very interesting. We will understand it as a story. So if we talk about the 1980s and 1990s, then it's that old when in the entire programming world, two languages were very famous, C and its successor C + +. They were the most famous languages. The reasons for their fame were that one, it was a very fast language, right? Rest, according to their old language, it was more simple, right? Apart from that, what other features were there in C, C + +? First of all, it was a very low-level language. Low-level. What does low-level mean? It was very close to hardware. Right? If at that time, you're building a language that is fast and very close to hardware, and still uses almost English-type syntax, then it was best. Right? Because any programmer could easily learn it. And what did it mean to be close to hardware? Let's say it's your processor, and it directly interacts with your processor, There was no layer of abstractions in this. If you ask what abstractions are, then abstractions, like in modern programming language, like take the example of Python, you don't have to implement a lot of things internally. You just say in English that we have to do this and it happens from inside. You don't know how it happens. But C, C + + was not that much. There were not many abstractions in it. You had to do everything in C + +, you had to do it in C as well. So you could get some work done with it. If you come from C, C + + background, then you would know what I am saying. And if you don't have any idea, then it's okay. You just assume that these two languages existed before Java. It was very fast, very simple, and it was a low-level language. So when everything was going well in the 1980s, 1990s, and almost everything was going well with C, C + +, then why did we think that we need a new language, a new successor language, let's say Java. Why Java? Okay. We will answer this question in this video. And this answer is very interesting. This answer, generally when you read Java, you are told what is special in Java. But it is never told why it is special. And why it was never in C or C + +. Right. Today we will answer all those problems. So first of all, we ask ourselves, why Java? Okay. Come on, it is very interesting. So, let's explore this as well, why Java and understand it as a proper story. So, see, when your C, C + + language was working perfectly and there was no problem, then suddenly people thought that there is one problem and that problem is of portability. Portability problem. Now what is this problem? See, what is being portable? Being portable means that you hold the code of C or C + +. Let's say this is your source code. Okay. Suppose there is a code of C, C + + written in it. Okay. I run the code of this C, C + +. Now if I want to run the code of C, C + +, if I want to run any code, then you would know that I have to use a compiler. Now no one knows what a compiler is. So, No problem, I'll tell you now. So, you understand, a compiler is nothing. It's a software, a compiler itself is a software, which can control any code, any language, It converts into machine code. What is machine code? Code of zeros and ones. The code that the computer understands. You know that the computer understands your binary. Let's say you have a computer. You have written a code in C, C + + like if, this, whatever the syntax of your C + + is. If you don't know, then it's okay. But your computer won't understand English words. It will only understand zeros and ones. So if it understands only zeros and ones, then we need a software in between which will read this C + + code and transform it into zeros and ones. Because even before C + +, if we talk about languages, then our assembly language used to work. Assembly language. It was closer to your hardware. It also had English words like move, copy, but they were less. Right? There were less English words and it was more hardware oriented. If we go back from the assembly, then you will have straight machine code. We had to write the sequences of zeros and ones to code. Which was very complicated. That's why we came to C, C + +. That we don't have to write zeros and ones, we write in English. Then we will make our own software, compiler. And it will translate this English into zeros and ones. Simple. So this was the work of compiler. So the problem of portability was this. Let's say this is your computer. I call it C1. And I make a new computer here, C2. If I compile this language and make a sequence of zeros and ones, let's say this. And this sequence is the machine code of this language. So this compiler which has compiled it must have compiled it for a single computer. It means that if I catch this machine code which can run on this system, if I try to run it on this system, it won't work. Okay, why won't it work? Because this compiler is the compiler of this computer. Now the word computer is wrong here. We should use the word platform instead of computer here. Now let me explain you what a platform is. Let's say this is platform P2 and this is platform P1. So the code that will run on platform P1 will not run on platform P2. So this compiler is platform oriented and so is the language. If I want to run this code on this P2, then I will have to compile it for this P2. Basically, I will use a compiler for this P2 and then I will get a new set of sequence of zeros and ones. Let's say I get this. Now I can run this code in this P2. Simple? So basically what happened here was that whenever I have to run my code on a new platform, I have to compile it for that particular platform. And this is a very bad thing. This is called the problem of portability. The C and C + + are not portable languages. Now, what is the problem with portability and what are the platforms? We will have to answer this question. Only then we will be able to understand it properly. So, I said platform. And what word did I use here? C + + was your platform dependent language. It was platform dependent. I have explained the meaning of platform dependent. If you want to convert C, C + + code into machine code to run on any platform, then you will have to compile it differently for every platform. Because all the machine codes will be different. Why are they different? We will discuss that too. We will go in depth with the first thought principle. So, first of all, let's understand what a platform is. Because we have used that word again and again, so let's define it. There are two things in a platform. One is your processor. Which processor you are running it on. And the other is your operating system. By combining these two, a platform is created. Let's see an example of this. Let's say I took a processor. Let's say Intel x86. I took this processor. And operating system, let's say I took Windows. So, we can call the combination of these two as a platform P1. Similarly, let's say I took another ARM processor and let's say I took an operating system Mac. So, I can call the combination of these two as a new platform. So, you must have understood what a platform is. We call a processor and an operating system group as a platform. So, what I told you above means that if you take a C or C + + code, And if you want to run it on one platform, then a different binary code will be generated. If you want to run it on another platform, then a different binary code will be generated. That means, every time, you will have to compile it first. By using a compiler, then you will be able to run it on that platform. That means, your language is platform dependent. So, this was a very big problem. Now, you must have come to know who solved this problem. Java. It must have made its language in such a way that the language becomes platform independent. We will see how it will be made in a while. First of all, let's understand that you have a question in your mind. That I told you that the code of C, C + + will be compiled for platform P1. And if you want to run it on P2, it will be compiled separately. Because we have the same machine code. Let's say the machine code here is 0100100. I cannot run this code on this platform if it is its code. Right? For this, I will have to compile it again. And it is possible that a separate code will be generated. Right? But why is it like this? Look. If I have written a code here, let's say hello world. So let's say I have written a code of hello world in C, C + +. Now I am not showing you the code because many people are studying Java from the beginning, they may not have come from the C + + background. So you just understand, somehow the code of C, C + + is written here. I have saved this code, let's say in a file whose name is hello.cpp. Because I save the C + + file with the cpp extension, so I have saved it. If the code is the same and I have two platforms, let's say P1 and P2. So if the code is the same and I have two platforms P1 and P2, then when I am converting the same code into machine code, then why are different binaries being generated? So you can give an answer to this by yourself that the platforms are different. Now let's say this platform is the one I gave the answer above. Let's say Intel x86 plus Windows. Let's write it correctly once. Okay. And this is the second platform. Let's say ARM processor plus let's say your Mac operating system. So these are two different platforms. So it is possible that a different binary is generated on this platform. Let's say 0100 of this same hello world. Dot dot dot. And on this, let's say 1, 1, 0, 1, dot dot dot. Anything. Random. But my question to you is, why? After all, if hello world is written here, and I have to convert it, then these are just zeros and ones, right? Why are different binaries being generated? We have to think about this too, right? We simply say that the platform is independent. Sorry, C + + platform is dependent. That means, for every platform, whether it is P1, P2, or if we introduce a new platform tomorrow, then a new binary code is generated for it every time. That means, it has to be compiled every time. So, first compile it here, then if you want to run it here, then compile it again. You can't run it directly. Right? But the question is, why? Right? So, to answer that, let's understand this carefully. Okay? I told you that there are two things in a platform. One is your processor. And the second one is the operating system. And by combining these two, a platform is created. For example, I took a platform P1 in which I took x86 processor and Windows operating system. I took a platform 2 like ARM processor and Mac as an operating system. What did I say? His binary will be different, his binary will be different. Why? We have to answer this. Let's understand this carefully. First of all, let me explain to you how binary code can be different if the operating system is different. Now look, when you write a C C + + code, again, let's assume this is a C C + + code. And I have saved this in a file, let's say hello.cpp. When you write a code of CC + +, right? And you compile it using a compiler. Compiler, okay? Here we have taken a compiler. So when you do something like this, then CC + + converts it into machine code, right? Absolutely correct. Now, you must have done a lot of things in your code. Let's say you must have tried to print something in your code. So, if you try to print something in your code, then actually what are you doing? You are commanding the operating system that I have to print something on the console. So, obviously you cannot print anything yourself. You have to talk to an operating system in a system to do any work. So if you have to print something on the console, then you must have given a command to the operating system. If you have to read write something in the file, you have to perform some operation in the file. Again, you have to talk to the operating system. Let's say you want to allocate a memory. So if you write a program, in that program, you will allocate a memory. Let's say we will read further if you don't know what variables are in a language. But you can declare a variable in a language. I said that there is a variable i, its value is 4. Store this. But it will store somewhere. So you will have to allocate memory. Right? So, to do all these things, you have to talk to an operating system. Right? But you haven't written such a code by yourself. You have just written commands. Like in C, C + +, you would have written cout. Right? Or you would have written printf if you use simple c. And if you don't know that, then it's okay. But I am giving an example that you would have written some syntax. So, what happens on the backend? When you compile it, then operating system, I will write this with pen. Operating system does what? It gives you its system libraries in compiled form. These are the methods. If you call them, it will be printed. You can't see its code in your source code. But when you compile it, then inside the machine code, your system library code is also there. Operating system code basically. So now it's possible that your P1 platform, in which you had used Windows, if I write it like this, if in our platform, when we used Windows, And if you want to print something from the system on the console, then let's say you have to call a method for example. Let's say write file. Example, whatever I'm saying. Here, let's make it simple. Write to console. Assume. I don't know which method will be inside, but let's assume that there must be some other method on Windows. But if I had to do the same thing in Mac, then let's say I had some other method. Write there, whatever. I'm assuming it's random, okay? But you understand that the methods that Windows has given you in the form of system libraries will be different. The methods that Mac has given you will be different. So, the binary code that will be generated will be different. Its binary will be different. Its binary will be different. Obviously, right? So, one thing is that due to the difference in the operating system, there will be a difference in the machine code. So, you understood this. Okay. So, what did I tell you? If you have the same hello.cpp file, you compile it into machine code. And one you are running it for p1 and one for p2. But because both have different operating systems. One has Windows and one has Mac. Because of that, the code of their system library will be generated differently. The binary of that will be different. Okay. So, from here, one thing got clear. Okay. What got clear? Due to the change in Operating system, our code, our binary can be different. Okay? So, this is clear. Okay? Now, let's go to the second reason. How can our code be different because of the processor? Okay? So, this is also very interesting. We are going to that depth that no one will understand. Right? But if you tell this knowledge in an interview, then the interviewer will obviously be flat. Okay? Now let's say we have talked about OS in the platform. Now we are going to talk about the processor. So, again, for example, we take two processors. Once we take Intel's x86 and here we take the ARM processor. Now, due to the difference between these two, again, if I write the source code again, let's say, this is a source code of C, C + +, in a file called as hello.cpp. And when I convert this, let's say, once I run it for platform P1 and once I run it for platform 2, then why will different machine codes be generated? Let's say, machine code 1 has come here, here machine code 2 has come. So, let's write machine code 1 as 01... here let's write 10... anything. So, let's understand this. Okay. First of all, what is a processor? What is a processor? If you see, a processor is nothing but a CPU. There will be a CPU in your computer. There will be a CPU in this and a CPU in that. Which is basically the brain of the computer. Central processing unit. You must have read this when you were a kid. Now, what happens inside the processor? There are transistors inside the processor. Okay. Those who don't know, it's okay. We will go a little deep. It will be fun. Processor has transistors and they are in billions. In fact, these days they are in trillions. Now, transistors have only one simple function. Either the current will go, then it will be 1, or the current will not go, then it will be 0. Maybe you have studied this in your childhood, or you have some idea, which we call on or off, right? The computer doesn't understand anything, the computer only understands binary. On, off. On means 1, off means 0, okay? So it can only do this. The computer, the transistor only understands this, either the current will go or the current will not go. Simple. One zeros, that's it. Now I said that we have billions of transistors or trillions of transistors, right? And the meaning of transistors is that either the current will go or not. Now understand it like this that when Intel or ARM has made their own processors, then transistors will be placed according to them, chips will be installed, and you know that if you have read this subject in your B.Tech or you are studying here, then In a CPU, in a processor, there are pins. Let's say P1, P2, there are a lot of pins. And these pins will be different in Intel and ARM. So basically, if you want to talk to a computer at a physical level, a processor is a physical device. A processor is a physical device, right? It's hardware. If you want to talk to that hardware and actually want to interact with the current passing or not passing, you may have to interact with Intel in some other way and interact with ARM in some other way, right? So, this means that if I want to interact with Intel and my code says, let's say, add two numbers. I have written this code. To add two numbers. I have written this code. Simple. Okay. So if I have written the code of add two numbers. And if I run it in Intel. Okay. So at the lowest level. At the hardware level. We will give some more binaries. To interact with these pins. Right. And on ARM we will give some more binaries. To interact with these pins or these transistors. So you understood this too. That because at our hardware level. Both are made of different processors. Both will have different types of transistors. Let's say one will have billions, one will have trillions. Or their numbers will vary more. So again, obviously, at the hardware level, their binary will also change. Their binary will also matter. Right? So let's say for platform 1, this was the binary. For platform 2, this is the binary. Right? So if you want to go a little deeper, a little, it will be fun. If you want to interact with a processor, with a processor, You have to interact with your program. This is your program and this is your processor. So there is something in between that we call ISA. What is the full form of this? Its full form is Instruction Set Architecture. Instruction Set Architecture. Spelling is very wrong but let's write it again. Architecture. Now this is happening. Look. Instruction set architecture is nothing. It just tells a processor how to do small commands. Like how to add. How to load data, how to store data, how to jump a value, etc. There is no need to go so much internal, you can understand a little. If you have read a language like MATLAB or if you have seen some internal code, then you will understand that your instruction set architecture tells you that that how to do small operations like add, load, store, jump in a processor. Right? So, what I mean to say is that, because your processors are different, if I tell you like this, because your processors are different, then both of them will be different than IIS. If someone asks you why these transistors are different and how they are interacting, then you should tell them ISA. Instruction Set Architecture. You can call it a language. It is an intermediate between your program and your processor which actually interacts with a processor. Now, because the transistors of platform 1 will be different, and sorry, the processors of this will be different, and the processors of processor 2 will be different, then the ISA of these two, i.e. instruction set architecture will also be different. What can you call ISA in a way? You can call ISA grammar. Grammar of any processor. So, one processor understands one grammar, the other processor understands the other grammar. Simple. So, now I have told you this, That there are two things in a platform. A processor and an operating system. And because both are different. Your generated binary code is different. It means same source code. Hello.cpp If I run it on platform 1. And on platform 2. So to run it on both. I will have to compile it in machine code. And what machine code will give me? Binary code. So it means. Its binary code will be different. Its binary code will be different. I have told you why it will be different. And once you understand this, then you understand the whole story of platform independent. So what I said C and C + + was your platform dependent language. In fact, all the languages before that were platform dependent. Because obviously, every language that was made till now, will convert any code into machine code. And I told you, machine code for every processor, for every operating system, means if we say in short, it is different for every platform. So this was a problem in CZ + +. It took a lot of time to understand the problem, but I hope you understood it in depth. The second problem that gave birth to Java was of simplicity. Now you will say, bro, you just said that C, C + + is simple. Absolutely it is. According to our old language, it's simple. But there were some things in it that made a language a bit complex. Java had to simplify it. So that everyone can easily learn Java. And whatever complex things are in it, we can remove them. Or we can abstract it. Okay. Now, what comes in simplicity, we will see in the future. What were the things in C + + that Java removed. Okay. And the third thing was security. Okay. Your C, C + + was less secure. So, Java had to be more secure. A language had to come that was more secure. And because of these three reasons, Java was born. Okay? Did you understand the story? Now, we can start that these things in Java, how they were solved, right? But till now, you have understood how Java was born. Okay? Let's go. Now we will start with Java So till now it was just a story about what were the problems before coming to Java So let's quickly see that Java solved three problems Java is portable Java is simple And Java is secure In this whole video you just have to remember these three things Simple, portable, simple and secure So now I will explain to you How Java solved the portability problem. Because if we apply the first thought principle again. You wrote a source code. So let's say this time I am writing a Java source code. So this time I am writing hello.java file. Whenever you save a Java source code. So the extension will always be. java. We will see that later also. So, let's not go into the syntax now. Let's say there is a Java syntax. I have written a source code, a program. Let's say it will also print Hello World on the screen. But, we have just discussed that if we have two platforms, let's say P1 and one platform, let's say P2. If I want to run this code on both the platforms, then I will have to convert it to machine code. And we have just discussed that its machine code and its machine code will be different. Right? How to handle this? To handle this, the Java that brought a concept, that was the concept of bytecode. Now this is very interesting and it will be fun to understand. So let me write this clearly once. Concept of bytecode. Okay. Bytecode has solved the portability problem of Java, sorry, the portability problem of other languages. Okay. Now, what is bytecode? We will understand it well. Okay. Now, you understand like this. Let's say, You are obviously Indian, okay? You visit a country tomorrow, okay? You are Indian. So, you visit a country, sorry, you visit a country, let's say, in China. Now, look, in China, Chinese is used, I mean, Mandarin is used. And you don't know Mandarin. If you want to talk to someone in China, and let's say, they don't know English or any other language, and they can only talk in Mandarin, then CC + + would say that you have to learn Mandarin, right? Obviously, like this was your source code. If you want to run on a processor, then you will have to make its machine code. Simple. So you will have to learn Chinese. Tomorrow you go to another country. Let's say you went from China to Spain. And let's say everyone knows Spanish, someone knows English. Now you will have to learn Spanish, only then you will be able to interact with people. So he was saying this. This was your C, C + + code. If you want to run the source code on the platform P1, then its machine code will be generated separately. If you want to run another platform on P2, then its source code will be generated separately. Let's say your source code is generated as 110... So this was the concept of CC + +. Or any other language before that. That you will go to any country and you will have to learn that country's language. Simple. Java said, no, we don't do that. Java brought a new concept. And what was that concept? Java said that you are Indian. You know one language. You know Hindi, Tamil, Telugu, wherever you come from. Or let's say you know English. Simple. You know one language. If you are going to China, then take a friend with you who is a translator. He knows all the languages of the world. Simple. Now, you have to interact with someone in China. What to do? Tell your translator friend. He will help you. Explain your translator friend in Hindi or English. He will convert it into Chinese or Mandarin and explain it to them. And he will convert their language to you. Simple. In the same way, if you want to go to Spain. No problem. You can take your friend to Spain. Again, because he knows all the languages. So, he will convert your language to Spanish. And he will give you their language. So, this was the difference between C and C + +. In C, C + + and Java. Now, I gave you an example to simplify the bytecode. How did C, C + + look at this and how did Java look at portability and how did it solve it. Now, if you understood the example that I take my translator friend and tell him to translate and I only know Hindi and English. If you understood this scenario, then you understood Java's bytecode too. So, look, how did Java solve it? It's very interesting. Again, I will write a Java source code. Let's say this is my Java code. Its name is hello.java. In this, Java code will be written. We don't care about it. We mean that we have two processors. Processor 1, not processor, let's say platform. And platform 2. Because platform is made up of processor and operating system. So, I knew that if I introduce a compiler for this and for this, then the machine code of both will be different. Right? So, Java also thought that I will keep a translator with me. So, who will be the translator? In this case, the name of our translator friend is called JVM. Its full form is Java Virtual Machine. Java Virtual Machine. Now, Java Virtual Machine, you can tell by its name that it's a virtual machine. It's a software, nothing else. It's a little cool name, Java Virtual Machine, but it's nothing, it's a software. What did it say? My JVM, I will give it this role, that you work, to convert my code into machine code, of that country, or of that platform. So, what did I do? I installed JVM on this platform, And I installed JVM on this platform. I installed both of them on the platforms. Now, I said that I will not use my Java code directly to convert it to machine code. So, let's say I have a compiler. Okay. I will not directly convert it to machine code. Because I don't want to learn machine code separately. What I will do is, I will convert it to an intermediate code which I named bytecode. Okay. I mean, I will first convert this hello.java to bytecode. Now, what is bytecode? As I said, it is an intermediate code. It is not a machine code, meaning it does not have zeros and ones. So, if I make it a little bit and show you, then let's say, this code which was finally generated, this was generated in bytecode, not in machine code. Now, if the name of this file in bytecode was hello.java, Its extension will be Hello.class file. We call it hello.class. When we write a proper program, you will understand how all this happens internally. But let's assume that you have a Java source code. You gave it to the compiler. The compiler generated it in a byte code. It is an intermediate file. And its name is hello.class. Whatever was its name,. java, it changed to. class. Simple. Now, This bytecode is the same for all. So now if you run this bytecode on platform 1 or platform 2, the same output will come. How will the same output come? Because our friend is sitting there, our JVM, our translator. Now what I will do is, I will run this bytecode on this platform. So, who is our friend on this platform? JVM. He will read this bytecode step by step and will convert it to the machine instructions of this platform. So, let's say he read this bytecode and changed it to his machine code. So, let's say the output in his machine code is 0100... Now finally, if I want to run this bytecode on this platform, then my JVM friend will read this bytecode and save it on the 0s and 1s of this platform. So let's say our output is 1101... which is different from this. So what happened? I took my source code, compiled it, and didn't directly convert it to machine code. I converted it to an intermediate bytecode. What will be the name of that file? Whatever is. java here, it will just be classed as. Simple. Now this bytecode, I only know this much, as I explained to you in the example, I only know Hindi, I can only speak Hindi, so I just convert my language to Hindi. Now my friend JVM, his job is to convert that code to that country or to that platform's machine code. So I just gave the bytecode, here it came, here it came, here it came. So again, this portability solved my problem. Now what do I have to do? I don't have to compile my Java source code again and again. If I just compile it once and make a bytecode, I can run this bytecode on p1, p2, or I can run it on p3 if I introduce a new p3 tomorrow. There is only one condition. On these three platforms, my friend named JVM should be sitting, whose name is Java Virtual Machine. Okay. Now, how does it convert code? How does it work internally? We will see that in the next lecture. But now, you have to understand that JVM's job is to convert our source code into that platform specific instructions. To convert it into its machine code. Okay. So, if you understood this problem, then this was the whole issue of portability. You understood portability. How Java handled portability. Right. Now, there is a small correction here. When we talked about our friend, that we have a friend with us, a translator friend, he translates the language of the country he goes to. With this example, you must be thinking that this JVM is our only friend. We have put our only friend in both of them. So here we correct that this JVM is not portable or this platform is not independent. This JVM is specific for this platform. And this JVM is specific for this platform. What does it mean? Let's say this is our platform of x86 plus Windows. And this is our platform of ARM plus Mac. Right? So these are our two platforms. So what it means is that this JVM, this software is made to run on this. And this JVM is made to run on ARM plus Mac. So I can't put its JVM here and can't put its JVM here. Right. JVM go play. dependent For every new platform Tomorrow I'll introduce a P3 So I'll have to write a new JVM for it Because, what does JVM do? By reading this byte code, it converts it into the machine code of that platform. So, whatever JVM I write for a particular platform, it will have to understand the machine code of that platform. It will have to understand that the platform on which I am running, what is the operating system on that platform, How can I call the operating system's system libraries? And which processor is on that platform? So if I want to talk to the ISA of that processor, Instruction Set Architecture, then how can I do that? JVM should know these things. JVM platform will be specific, only your bytecode will become independent. So one java took a trade-off that now I have to write JVM for every platform Once I write JVM for every platform, then I will take source code and convert it into bytecode Once converted, now you can run that bytecode on p1, p2 or p3 So this is a little correction, you can understand this that I don't have one translator friend here In every country, I have kept one translator friend I took a translator in China, I took a translator in Spain. And their job is that they understand Hindi and translate it in that country's language. Simple. So, this is the whole story of portability, right? So, if I write carefully, then Java is portable. Or in other words, and in some cool words, we call it platform portability. independent so you must have understood that java is platform independent and nowadays we call it Vora this is a short form its full form is write once run anywhere so now you must have understood why this is a short form once you write your source code compile it after that you can run it on any platform run anywhere Because in those platforms, our JVMs are installed. They easily convert our bytecode to machine code. Simple. Now, the second question that should come to your mind is, why is portability such a big issue? I mean, why do we need portability? I mean, you said, we don't have to compile again and again. But what is the issue in compiling? It must be coming to your mind, right? What is the issue in compiling again and again? I will give you the answer to that. If you... Think about what will be happening in the 1980s and 1990s. Let me tell you that many new technologies were coming. If I write this in a pen. New technologies were coming. New embedded systems were coming. For example, the set-top box. Right? Your TVs were made Right? Etc. Etc. A lot of new devices were coming Electronic devices were coming And on every device And like nowadays smart devices are also coming On every device Different applications had to be run Right? And I wanted this Or those who made Java, specifically they wanted to make an application in that language. Let's say I wrote Java. Now I made an application in that. I can run it in the set-top box, I can run it on TVs. Or whatever new devices I am making, I can run the application on that. Okay. Obviously, That device should be Java enabled, obviously it should have JVM, Java support, etc. etc. Those are the conditions. But, what I mean to say is that the portability requirement was there because See, C and C + + are very fast. Saying this was very redundant because Java was also faster. Obviously, now you will say that Java is not as fast as C, C + +. Agreed. Our hardware, basically our processor was so fast by itself that it doesn't matter how much your language is hardware specific or how much Efficient for hardware. Right? So they needed a general purpose language. General purpose language means that it can run on any device. Right? And because these days processors have become fast since the 1990s. So you can see how fast the processor is today. If you are running a slow language like Python easily and using it everywhere, then Java is still very fast. Right, so on those processors, Java could run easily and you don't face any problem of speed. So speed was left behind. Now the main thing was, for every platform, we wanted a common, general purpose language to run on every platform. That was Java. If I give you more points, at that time, the internet was starting new. Now what happens on the internet, if you look at it these days, you have a front-end and you have a back-end. And front-end and back-end interact with each other. Now I said you wrote an application, you wrote a code, let's say. And you wrote that code, let's say, sorry. You wrote a code, let's say you wrote in Java. Okay. Now, your code will be deployed on a server. If you know what a server is, then server is also a computer. And if a server is also a computer, then that computer will also have its own platform, i.e. its own operating system plus its own processor. Suppose I have to deploy my application from multiple servers. One server is this, one server is that, one is platform 1 and one is platform 2. If my java is not portable, then I would have to compile and run for it. Then I would have to compile and run for it. Whenever I am introducing a new server whose platform is different, I have to compile my language first, then I can run it. This is a big problem. So, I have explained you many reasons why portability was required and why Java brought Vora, which means Write Once Run Anywhere. A lot of devices were coming, the internet was being made, and we needed languages that could run on any platform once compiled. We don't have to compile it again and again. So, this is the problem of portability. Now, in Java, I had told you that two more problems are solved except portable. We understood this. The second was that Java is simple and Java is secure. Now, let's understand simple and secure. Look, before Java, the C, C + + or whatever languages were there before that, were simple. Especially C, C + + were simple. But even in that, there were some terms, some things which made that language a little complex. Like, having pointers. Now, when we will read Java, we will understand why it was a problem. Right? Apart from this, having multiple inheritance. Okay? Apart from this, what other things can happen? Those who know about C, C + + might know. Yes, to allocate and de-allocate manual memory. Especially to de-allocate because you will allocate it yourself. So, all these were the problems of C, C + +. Those who don't understand and those who don't know about C, C + + background, it's okay. You understand that there were some problems in C + + or C which made this language a bit complex. Java came and Java removed all these three things. Java said that we don't need pointers, we don't need multiple inheritances, and we don't need to manually de-allocate memory. Java removed all these things. What did Java bring and how did it do it, we will see that in depth in this series. But for now, Java removed C and C + + and simplified the language. So I hope you understood the simplicity of how Java is simple. Now there is one last point. How is Java secure? This is also very interesting. See, what is security? I have made Java so that Java runs anywhere. It is a portable language. If I compile it, then I can run it anywhere. So when this was happening, as Java developed, Java started to be highly adopted. In fact, even today, half of the internet is running on Java. If you go and see on Oracle's website, how many billion devices are running on Java today. So you must have understood. Java got widespread very quickly. So many developers started using Java. So what happened? Then we thought that because Java is a platform independent language, we can use it for back-end. Like I told you that we can deploy it on any platform. So here they brought a concept of Java, Java servlet. I don't know, it's okay, we'll all read it comfortably, we'll go in-depth later. But you understand, Java servlet is nothing, it's a program of Java. And that program does an API work on the backend, which happens nowadays, that it can bring something, it can put some value in the database, servlets, okay? Here, not only that, people started using Java on the frontend too. Yes, Java came before JavaScript, right? In fact, let me tell you a fun fact. Fun fact is that the name JavaScript was named because Java was the most popular language at that time. So they had to show their language that how popular we are. Basically, it doesn't happen that a very trending thing is going on. If you take that name, then you also become famous. So again, let me tell the fans of JavaScript that the name of JavaScript was also named Java. Although it has no relation to Java. But it's just that because it was trending, so if I name my language Java, then my language will also get trending again this was just a fun fact, let's jump back java came before java script so people understood that if I can use java on backend and if java platform is independent then can I use it on client side or frontend and the answer was yes, meaning that Your Java was used in the front-end as well. Think about it. What is front-end? Client side. If you have read web development, client means people's web browsers. Now, every person's system is different. That means, there will be so many platforms. Your operating system will be different. Your processor may be different. Mine will be different. Right? And Java is our portable language. It can run on any platform. So, if it is a portable language, can we run it on front-end? Absolutely, we can. The answer to this was Java's applets. So, just like Java's servlets, applets are a lightweight code that we can transmit over the internet and It can be run in the browser of the user. So, imagine how interesting it was. Let's say there is a link and if you click on that link, an applet will be downloaded and it will run in your browser. This is a very old thing, it doesn't happen anymore. Because JavaScript has come now. So, what could you do with the applet? You could make an initial frontend with the applet. Basically, you made a basic form, right? That means you took some input from the user. If the server has given you some output, then you displayed it. let's say, a small calculator on the front end, let's say a loan calculator. loan calculator, something like that. So, you could have done some front-end with the use of Java at that time, using Java applets. So, Java's servlet could have been used in the backend, applets could have been used in the front-end. So, there were so many use cases of Java. Now, the problem came from here, that if there are so many use cases, then it can be misused too. I told you what applets are. Basically, if there is a link, click on it, there are applets in it, it will be downloaded, your code will run in your browser. But if, It's so easy to do all this. So, what can I do or what can a hacker do? In your code, in your applet's code, he can put some such things in it. He can take some permissions of your system which can crash your system or copy your data, steal your data, right? There could be a lot of things. So, that's why Java used another concept which is Java Security. And this is not a new concept. We have just read JVM, right? Right? What did we read? We read that JVM is a software which is platform dependent. It is made for every platform. Okay? And what does it do? It converts our bytecode into machine code for that platform. So, what did JVM do? This source code, sorry, not source code, our bytecode. JVM will run our bytecode, right? So, what did JVM do? We said, you run our bytecode in a secured environment. Secured environment. in the environment. That means, I'm saying that if this code that I've downloaded from the internet is asking for some useless permission, then don't give it. Restrict it. Run it in a restricted environment. That means, run it in a safe mode. So, this was the feature of JVM that provides security in Java. Now, how does it provide? We will see this in the next lecture in depth. But now you understand that JVM provides a secured environment to run any bytecode. So that this bytecode or whatever its source code may be, it may not demand such things on your system which may be harmful for you, right? Some virus may not run. So this model is called Java. If you go into its theory, then this model is called Java's Sandbox model We call this as java's sandbox model Simple. Sandbox model means a restricted space where you run a code so that it gets an access that it shouldn't get. So, with this sandbox model and the use of JVM, what did Java provide you? It provided security. Right? So, here we understood the third point that Java was very secure. And how was it secure? Using JVM. So, in fact, if you understand this carefully, then Java has two problems. One is of portability and security. Both of them solve JVM alone. So how important will JVM be? But simplicity is obviously solved by Java's syntax itself. Because Java is simple, it is the syntax of Java. But two problems of portability and security are solved by JVM alone. And we saw that Java was used on the backend as well as on the frontend. So how much space was used for Java in the beginning? Let me tell you. Currently JDK is discontinued from 10 or 11. Now applets have no use. And what happens with JDK, we'll see in the next lecture. You just understand, the new versions of Java, every language changes a little, its new versions come. So JDK 10 and 11, I don't remember exactly, maybe in 11, applets were discontinued, that now it has no use, because no applets are being made on the frontend, right? But in the past, Java, using applets, was also involved in frontend technology. So this is the concept. I told you that today we will understand these three topics and I explained to you portability, simplicity and security. And this was the reason which changed the world, made Java such a highly popular language. Today you may think that Java has cool languages, Java has fast languages, this is that but Java is irreplaceable. It hasn't been replaced yet. It might happen some day. But Java's use case is very high. Half of the internet is running on Java. Before we go, let's discuss one more thing. Which might be coming to people's minds. Because we are talking about the first thought principle. So, you said that Java for us... Sorry, let's write this from the pen. Java brought a very good thing for us. Which was bytecode. Right? And it brought one thing. That's JVM. By the mixture of bytecode and JVM, I can make a language platform-independent, right? So why didn't the CC + + people do the same thing? Let's assume that they didn't get the idea first. But when Java was created, then they must have understood that they can do the same for CC + +. First, let's generate an intermediate code, let's say bytecode, and make a virtual machine, let's say they call it JVM, Java Virtual Machine, we call it CVM. C + + virtual machine or C virtual machine, right? So, using the same concept, will I not make this C, C + + platform independent? The answer is, you will definitely make it. You can make it. And in fact, if I tell you, these small experiments were also done, but not with C, C + +. If you look carefully, if you go to history, then Microsoft has C sharp ke saath ye experiment kiye the. Aur wo successful bhi huye the. Again C sharp ek aisi language ban gayi thi jo platform independent hai java ki dara. Aur C sharp jo hai close cousin hai. Kis ki? C + + ki. In fact tabhi uska naam C se start hota hai. Right? C sharp. Now, why is it not done with C + + and C Sharp? It's a very simple logic. Because we didn't want to see C and C + + as platform-independent. We wanted to see it as a hardware-close language. A language whose job is to run fast, to be hardware-close. It doesn't work to become platform independent, right? It serves everyone, right? So we didn't want to make so many changes in that language. That was the main point. That's why Microsoft did a few experiments in C, C + +, to make it platform independent, but they didn't succeed. Mainly, they brought C sharp as an alternative to Java. But again, C sharp became very famous. It is used in many places even today. But it couldn't become as famous as Java, right? If I tell you after this, then all our modern languages which came after Java carried forward this platform independent nature. For example, I told you C sharp, right? Second, Python. So, all these internally are following the same principle to become platform independent which Java does in a slightly different way. But mainly, this concept of platform independency was brought by Java. Right? So, I hope you have understood in-depth how Java platform independent is. How he made that legacy of platform independence. And modern languages C sharp, Python. Today platform independence can be done. Okay. So I have explained you the concept. That by combining Java's bytecode and JVM. They make it platform independent. And this principle. You can implement it in any other language. And you can make it platform independent. Theoretically. A little bit. Things have to be changed, right? Because there is a difference in the syntax of the language. And how does it run? Is it a compiled language or an interpreted language? We will see all this later. But in that way, by making a few changes, you can do all this work. Right? So that's it in this lecture. I hope you understood. The first lecture got a little big. But we talked about only three things here. Mainly, which were Java's portability, simplicity, and security. And these three things made Java a sensation. In the next lecture, we will enter a little more into the internals of Java, in-depth, and then we will write our first program of Java. That's all in this video. We will meet you in the next video. Till then, thank you so much.
