Java, Java file structure (not only apostasy!)

Java from entry to the file structure of the meal just use IDEA development.

New Package

package name usually selected company domain ( https://tieba.baidu.com/) reversal

created is such that

the corresponding three folders
we created a class

package com.baidu.tieba;

public class Person {
}

The above statement is the class package, this indicates that the current class Person is subordinate to tieba this package.

We write. "" In fact, on a tiered folder.

We write a package called com.amd.cpu, and build a class called Amdcpu

And then, paste it in every Amd fans, all with brand amd cpu.


But this is wrong, IDEA gives us automatically modify the error is:

because Amdcpu not in the Person class, so you need to import.

import com.amd.cpu.Amdcpu;

Is introduced (import) Amdcpu class com.amd.cpu package.

Guess you like

Origin www.cnblogs.com/maomaodesu/p/11692155.html