Future learning path and future learning path

Source: Internet
Author: User

Future learning path and future learning path

When I wrote a website, I found that my basic java knowledge was not very strong. Indeed, in order to write a real project, I learned all kinds of knowledge frantically. I only wanted to understand it, but I didn't go deep, now I have discovered the problem. I will go back and learn again, and I will repeat it from the backend to the front-end.

In the future, the learning path will be: java BASICS (java multithreading, may last), HTML & CSS, javascript, jsp, Servlet. Then, use this knowledge to write several projects and integrate them to clear the relationship between the front-end, backend, and database.

  The book used to learn java is Head First Java. If necessary, you can leave a message.

Today, I want to start with java and learn like a tom (I am a Tom myself ).

JDK installation and environment configuration will not be mentioned.

A Brief Introduction to java. Java is an object-oriented programming language (OO. The object-oriented thinking will not be introduced here and will be reflected in future articles.

Let's talk about the java program execution process. Source file --> compiler --> byter code --> jvm. First, you need to write the source file, compile it, compile the bytecode file, and finally send it to the java Virtual Machine to execute the bytecode file. This is the process of generating the java program.

Don't talk about the preparation knowledge. You can go to MOOC to learn.

 

Enter the topic below, write a classic program, and output hello world, hahaha.

Suppose you have installed jdk and configured the environment. Now we don't need to use MyEclipse for development, so we can practice keyword writing, and it is easy to find some errors. The more errors we find during learning, the better.

First, create a text document on the desktop and change the suffix txt to java.

----->

Open the file with the following code:

1 public class Test {2     public static void main(String[] args) {3         System.out.println("Hello World!");4     }5 }

Save, open cmd, enter the desktop, and enter the following command:

If javac Test. java is correct, enter java Test,

There will be exciting results :.

The following code is explained in detail.

Public: It indicates public. It is modifying the attributes of this class, indicating that everyone can access and use it.

Class: indicates that you write a class. public and class are built-in keywords and cannot be changed.

Test: the name of the class. You can call it as you wish, such as Hello. The first letter of the class name should be written as a regular character. Of course, the lower case is also good. It is better to write it in upper case and you will know it later.

A program must have an entry. Where can we start executing the program. Public static void main (String [] args) {} is the entry of the program. A public class must have such a method (or function), and put the items to be executed in braces, for example, the execution of this program is: System. out. println ("Hello World! ");

System. out. println means to output a sentence to the console. Here is Hello Wordl! , You can output any sentence, you can change it, and output hello to the console, java! .

 

Note: The name of the public-modified class must be the same as the file name. For example, if the file name is Test. java, the class name is Test.

 

Summary: The unit in java is a class, and the entry to program execution is: public static void main (String [] args ){}.

 

Let's continue:

A java source file can only have one public-modified class. If you do not believe it, you can try it yourself. learning is a process of constant experimentation. But there can be classes not modified by public:

 1 public class Test { 2     public static void main(String[] args) { 3         System.out.println("Hello World!"); 4         A a = new A(); 5         a.f(); 6     } 7 } 8 class A{ 9     public void f() {10         System.out.println("this is A class");11     }12 }

 

The execution is correct.

 

The following describes the basic statement, loop, AND branching of a Program: the statement is like:

int x = 3;String name = “Dirk”;x = x * 17;System.out.print(“x is ” + x);double d = Math.random();

 

Such a thing.

The loop structure includes:

While (expression) {}, do {} while (expression), (;;){}

Branch statement: if () {} else {}

Later.

 

Example of writing a while loop:

1 public class Loopy {2 public static void main (String [] args) {3 int x = 1; 4 System. out. println ("Before the Loop ");
// If the value of x is less than 4, execute 5 while (x <4) {6 System. out. println ("In the loop"); 7 System. out. println ("Value of x is" + x); 8 x = x + 1; // The Value of x plus 9} 10 System. out. println ("This is after the loop"); 11} 12}

 

 

Result:

 

Example of writing a branch:

1 public class Test {2   public static void main (String[] args) {3     int x = 3;4     if (x == 3) {5     System.out.println("x must be 3");6     }7     System.out.println("This runs no matter what");8   }9 }

 

 

 

Well, these are basic things. They are the first time to write, so they are very difficult to write and tired to write. I hope to enter interesting content quickly.

 

We welcome like-minded people to explore and study together.

 

 



 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.