When I first started learning Java, I had this question for a long time.
What exactly is Java? What can it do?
I’ve read a lot of courses and books, and most of them start with the history of Java, and in short, you know, Java has a long history, Java is great, Java is getting better and better, more and more people are using it, you know, programming language number one all the year round, and then some other things, And then Hello World! And so begins the first code of your Java career, which means “Hello world!”
I still don’t know what Java is and what it can do. Can you tell me first?
You probably had this question when you first started learning Java, so what do you do? You don’t know. What do you do? Ask someone else? No, you might think of Baidu, not baidu
Just Google it and you’ll know?
Ok, let’s go to Baidu and have a look:
The first one is baidu Baike’s introduction to Java, click to have a look, Baidu Baike’s introduction to Java is like this:
Java is an object-oriented programming language, not only absorb the advantages of C++ language, but also abandon C++ difficult to understand multiple inheritance, Pointers and other concepts, so Java language has powerful and easy to use two characteristics. As a representative of static object-oriented programming languages, Java language perfectly implements object-oriented theory and allows programmers to do complex programming in an elegant way of thinking [1]. Java has the characteristics of simplicity, object-oriented, distributed, robustness, security, platform independence and portability, multi-threading, dynamic and so on [2]. Java can write desktop applications, Web applications, distributed systems and embedded system applications, etc. [3].
Continue to search for other articles to see how others introduce Java, click on any article, and look, this blogger says:
Java is an object-oriented programming language for writing cross-platform applications. In short, Java is just a language, but a language for the JVM. Java is compiled into bytecode, which the JVM interprets as machine code and acts accordingly.
Baidu Encyclopedia that said C and C++, and what object-oriented, distributed, and what static object-oriented programming, feel a little do not understand, see this blogger wrote, seems to understand some, but what is the JVM ah?
You see, just began to learn a Java, did not think what is Java is not clear, a little lost!
QingGe said: a lot of people just started to learn Java won’t be so careful when you go to study what is Java, most of them are baidu search have a look at what is Java, reading or watching video, listening to others talk about roughly what is Java is the past, as a result, suddenly someone ask you what is Java, looks like you don’t know how to say, I think it’s, uh, a programming language.
So how to understand Java, how to say? You want people who have never done programming to know what Java is, right? There are?
There must be. What is Java?
First of all, remember that Java is a language. What is a language? Java is also a language, what’s the difference, like Chinese, for our people, most of us Chinese are using Chinese to communicate, Java is also a language, but we do not use Java language to communicate, that Java is the language of communication?
Java is the language that computers communicate with us. Computers can understand Java. Of course, you learn Java, you know the language, and you can communicate with computers!
For example, if you say to your girlfriend, “Pour me some foot wash!” “Then your girlfriend hears this, knows what she has to do, and goes to pour your foot lotion (which is not the case in most real life, haha).
So if you communicate with a computer and want a computer to do something for us, you can’t always say, “Hey, computer, pour the water for my feet.” The computer really doesn’t understand, so what do you do?
Communicate with the computer in a language it understands, of course! What is that, Java is ah, you can use Java to communicate with the computer, of course, the communication here is analogous to us between people, in fact, for the computer, the accurate should be we give instructions to the computer, the computer receives our instructions to do the corresponding thing.
How, have an impression roughly! What is Java, understand so a lost it!
Java is a language, remember, it’s a language for computers, we use Java to talk to computers, we write Java code, the computer knows what we want to do, if you write normal code of course, so Java can be called a computer language.
Maybe some people don’t understand again, what is computer language, this? A computer language is a language between computers.
Computer language refers to the language used for communication between people and computers. It is the medium for transmitting information between people and computers. But the concept is broader than a general-purpose programming language. HTML, for example, is a markup language and a computer language, but it is not a programming language.
See here we want to affirm a concept again, what?
Java is a computer language. It can be used to communicate with computers. We can use Java to give instructions to computers.
Ok, moving on, let’s look at programming languages, what’s the difference between a programming language and a computer language?
First of all, you should know that you learn Java, after you can say that they are programmers, code farmers, knock code, dry programming!
You see, we are talking about programming again, let’s talk about programming language first, we said that Java is a computer language, is that a programming language?
Of course, Java is definitely a programming language. Remember this:
Computer language includes more, it includes programming language, in addition, computer language also includes markup language, modeling language, you may be confused, what are these? Well, I don’t know, so forget it. Just remember, computer languages include programming languages. Java is a computer language and a programming language.
Here, urgent need to explain with everyone, what is programming language, Bacco said to him like this:
A formal language used to define computer programs. It is a standardized communication technique used to give instructions to a computer. A computer language allows programmers to define exactly what data the computer needs to use and precisely what actions to take in different situations.
To be simple, to be plain:
We can write programs, which means we can use them to make computers work
Java is a programming language, of course, there are a lot of programming languages, just as each country has its own language, there are also many categories of programming languages, take a look at the picture:
Look, it’s a lot, but forget it, we’re focusing on Java.
Now that we know what Java is, how to use it? Can you give me an example? Ok, next, let’s have our computer pour our foot wash and walk.
By the way, you should at least know that the Java programming language requires that you write, that you type code.
Qingge said: what is the code ah, generation is representative of the meaning, code, this is not what we ride that thing, here refers to the binary code, so the code is “representative of the binary code”, this piece, the back will also be introduced in detail, take your time.
Now let’s start typing code, open your Notepad, and write this:
public class Hello{
public static void main(String[] args){
System.out.println("Hello, get me some foot wash."); }}Copy the code
We’re telling our computer to do the work for us. When we’re done, save the file. We’re going to change the file format to one that ends in “Java” and call it “Hello.”
Look, there it is:
Then we open the CMD command line on our computer. There are several ways to open CMD. One common way is to press “win+r” and this will appear:
Enter CMD, then ok, and the “black window”, or DOS command window, appears. Which is what it looks like now:
I don’t have that CD, I just typed it, so please type a CD, for those of you who know what that is, and then drag the “hello. Java” we just created into the black window, and it looks like this:
Then make sure to delete the following “\ hello. Java”, then press Enter, or “Enter”, and this appears:
Ps: Here one could make a mistake, we when programming beginners always meet all kinds of wonderful work, a lot of people confused don’t don’t of, say I do, why you can’t, beginners appear such problems, most of them are caused by their careless, to say their own, in the end, not letter wrong, is forget Spaces, The other important thing is that punctuation is not in English, so if you make a mistake here, see if you make the mistake I said.
Next, we continue typing:
javac Hello.java
Copy the code
And then go back to the car, and this time it doesn’t matter, that will create a new species:
What new species has emerged? Here it is:
This is a Java bytecode file, also called a class file, because the name ends in class.
See, we typed the following command again:
java Hello
Copy the code
Then we see an output:
Hello, get me some water for my feet
Ps: If you are following my instructions on your computer, you may have made an error when typing javac, because you lack a Java runtime environment. We will cover this later, but you can see the result first.
Some people say, “What is this?” I’m a little confused. I told you before that we could use the Java language to tell computers to do the work for us.
Let’s look at this code again:
public class Hello{
public static void main(String[] args){
System.out.println("Hello, get me some foot wash."); }}Copy the code
This is a section of the simplest Java code, as for why to write, you do not care, we said that you can use Java to give instructions to the computer? Where are the instructions?
System.out.println("Hello, get me some foot wash.");
Copy the code
It’s basically a command we give a computer to print on the screen:
Hello, get me some water for my feet
Let’s look at the output and see if it prints this sentence:
You see, the computer is not in accordance with our Java instructions to make the corresponding action, of course, this is the most basic, the simplest.
At this point, I’m sure you have a general idea of what Java is, but the big question remains: what does Java do?
We give a simple example above, is then a diu diu code, but also can have very complex, super more code, so that can produce a have many functions, such as we can use Java to write a calculator, what calculator, just similar to bring their own calculators on your computer, such as we often use qq again, We can also write one in Java, and of course, the more complex the application, the more difficult it is to write, or we can create a website in Java that displays whatever you want on the website.
However, Java may write system more, is a variety of background, what is the background, for example, you enter taobao to buy things, you login your account and name, and then enter the home page, and search “delicious”, and then will come out a lot of delicious.
Why you type in the name of the account and your can enter the website, that’s because written in Java code a logic, for example, your name is 1, the password is 2, when you click the login button, Java code will do judgment, if the name is 1 and the password is 2, let you go in, otherwise it into don’t go, this is Java code.
When you select a delicious, then place the order and fill in the address, and then you can happy shopping done, then businesses need to deliver goods to you, so businesses will be on a web site, you call what, in this inside can see what to buy, where is the address, and then give you the delivery, merchants log in this website can be called the background.
See, Java can do such a site.
As you learn, language is a tool that can do a lot of things, not just websites or desktop applications.
Having said that, you can get a general idea of what Java can do, but I know your understanding is still a bit vague, so let’s talk about that.
There are actually three versions of Java:
- JavaSE
- JavaME
- JavaEE
You can roughly understand that JavaSE is the core foundation of Java, including the basic knowledge, self-study Java just started from this, JavaME? I don’t know if you’ve played that game before, but before android phones, we would download some game files at the end of the JAR to install, and when we opened it, there would be this icon:
Can you understand this is JavaME out, but then came out android, instead of it, so don’t too mind, as for JavaEE, could be called an enterprise application development, this chapter to learn all kinds of framework, all kinds of advanced, is also our main learn later, we can use this part of the intellectual development of a variety of sites, Desktop applications, tools, even games, of course, many applications are implemented using Java’s comprehensive technology.
Now many people learning programming will be confused at the beginning of which programming language to learn, in fact, “iron thought, flowing language”, language is a tool, how to use, can do, it depends on the user, if you are good enough, then you can:
Change the world with Java!
Epilogue: This article is equivalent to a pilot course, the purpose is to let everyone have a preliminary understanding of Java, later there will be more detailed introduction, will take everyone step by step to uncover the mystery of Java!
Pay attention, pay attention! This article is my original Java self-study tutorial QingGe about Java, first, the subsequent will continue to update, the pursuit of more complete, easy-to-read, and deep, and I in the study of collected nearly 5 t of Java video learning resources, many of them are paid resources, their buying, if you have needs, can contact me, I will give it to you for free, we study together, communicate more, scan the qr code below, reply “Qingge”, boutique resources immediately get
If you have any questions about this article, you can leave a message, or scan the code to find me directly!