Dedicated to those who are lost in helloworld after studying for a day

There is always a group of people who muster the courage to say to themselves: I must succeed in changing jobs and get a high salary!

Did you say what you feel?

Wandering to various Java beginner groups, interviewed many beginner netizens, communicated about the experience of trying to enter the Java industry, and received various strange questions:

'Why are there so many words that cannot be understood in Chinese? ~Return value~Method~Static~What is it? '

'Why write helloworld class? What is helloworld after a name? '

'How to remember so many dos commands'

How to explain a series of problems that make many java teachers confused?

I believe that this embarrassing scene is not only because the lecturer needs a certain amount of time to refine the answer,

Thousands or even hundreds of thousands of people who want to change careers will become deadlocks! ! !

   Friends set the bench, see how the editor can get you through the two channels of Ren and Du, and interpret the first program! ! !

Most of the videos talk about the helloworld program in the same way, but for the indigestible Xiaobai, dragging his life forward will really understand it, is it really not happy?

I believe there are 10,000 grass and mud horses churning! ! !

Let’s stand in Xiaobai’s position and listen to how to explain this day’s procedures

 

Variable variables must be variable quantities

Just like I can say that cucumbers are vegetables, tomatoes are vegetables, and eggplants are vegetables;

I also said that apples are fruits, bananas are fruits, pears and peaches are also fruits;

People who make you say that a vegetable and fruit are different will say different names. This is the variable amount! ! !

 

When you first come into contact with these obscure special programming vocabulary, it is like a child’s parents who just learn to speak and drag idioms like a bird . There are several ways to understand:

  • Find a special reference book for reference (the explanation is in easy-to-understand language). For example, "Pickled  Zang 孓孓ā zā jié jué " Pickled Zang means dirty and unclean. Mosquito larvae are the middle stage of mosquito growth from egg to pupae. But such reference books may be few and far between;
  • Find a teacher who has a very thorough understanding to explain the questions you asked in plain and easy-to-understand language.

Now try to show off the program whose class name is helloworld

Class name: As the name implies, give the class a name. It's the same as a cat or dog, but I guess that when the developer wanted the computer to design the first programming, it represented the advent of it, and then gave it this name.

Explanation 1:

First, we give the class a name (helloworld). The class is a whole like our human body from head to toe. Then this whole has its symbol (the representation method is a pair of braces {}), The basic model is out

class HelloWorld{

//因类名书写有相应规范,大驼峰命名法也就是所有单词首字母大写

}

Since the comparison is made with people, does the execution of any action of a person depend on a major organ to dominate? The program is also supported by a main method. This main method is written for you first. Later, I will disassemble the composition of the method.

public static void main(String[] args){}

The operation of the method must be attached to the carrier of the class, so there is the following procedure:

class HelloWorld{
    public static void main(String[] args){
    
     }
}

Now that the main method can be used to do the corresponding instructions, I will now let it print something on the screen. This is to establish communication between humans and computers. At this time, we need to find out (out) the corresponding words from the computer system (System) and let it print (print), which is System.out.print();

class HelloWorld{
    public static void main(String[] args){

        System.out.println("Helloworld");
       

        }
}

 

Explanation two:

First of all, we realized that since we let the computer output helloworld, we have to establish a dialogue with the computer, and we have to print out the output content of it (computer system memory). Well, let’s try it.
        

System.out.println();


    We found that this sentence does not seem to be able to talk to us directly. Why is that? Let me tell you that the output of any statement needs a main method to execute. How to write this main method?
       

 public static void main(String[] args){

}


    In fact, there is still a lot of knowledge involved in the above line of code. Let's not explain them one by one. You can continue to pay attention to the knowledge I told Xiaobai.

    Closer to home, after solving the method problem, we found that the implementation of a method, that is, a skill, requires a carrier to play its role. So what is this carrier? That is the class, let’s call it HelloWorld for now
 

  class HelloWorld{

}


    Now that I have written this, I believe that everyone will understand this code almost, let's write it!

class HelloWorld{
    public static void main(String[] args){

        System.out.println("Helloworld");
     }
}



        Have you got it yet?

Friends, the time has come to test your eyesight and exploration spirit. Have you found any difference? If you want to solve the problem or learn more, please add v. 15315347983

Guess you like

Origin blog.csdn.net/sinat_40775402/article/details/90175204