package china.beijing; package china.beijing; //【1】 class People { static void speak(){ System.out.print("take care of"); } void People(int m) // B { } } public class E { public static void main(String args[]) { People zh = new People(); //【3】 zh.speak(); //【4】 } }
时间: 2023-06-18 18:05:48 浏览: 59
这段 Java 代码存在一些问题:
1. 在第一行,包声明不能重复,应该只有一个 package 语句。
2. 在 People 类中,方法的声明应该使用方法名而不是类名。
3. 在 People 类中,构造方法的声明应该使用类名而不是返回类型。
4. 在 main 方法中,创建 People 对象时应该传入参数,因为 People 类中没有无参构造方法。
5. 在 main 方法中,调用 speak 方法时,应该使用类名而不是对象名。
修正后的代码如下:
```java
package china.beijing;
class People {
static void speak() {
System.out.print("take care of");
}
People(int m) {
}
}
public class E {
public static void main(String[] args) {
People zh = new People(1);
People.speak();
}
}
```
相关问题
buildroot/package/ .mk config.in
These are three different files used in the Buildroot build system:
1. `buildroot/package/*.mk`: These are Makefiles used to build packages for the target system. They contain information about the package source, compilation flags, installed files, and dependencies.
2. `buildroot/package/config.in`: This file defines the configuration options for each package. It is used by the Buildroot menuconfig tool to allow users to select which packages to include in the build.
3. `buildroot/config.in`: This file defines the global configuration options for the Buildroot build system. It is also used by the menuconfig tool to allow users to configure options such as the target architecture, toolchain, and build options.
Together, these files provide the necessary information for the Buildroot build system to create a customized root filesystem for the target system.
Error: Timeout was reached Reading package lists... Done
This error message usually indicates a problem with the internet connection or the server that the package lists are being downloaded from.
Here are a few steps you can take to troubleshoot this error:
1. Check your internet connection: Make sure your device is connected to the internet and that the connection is stable. Try opening a web browser and loading a website to see if you can access the internet.
2. Update your package manager: Run the command `sudo apt-get update` to update your package manager. This will refresh the package lists and may resolve the issue.
3. Try a different server: Sometimes the server that you are downloading package lists from may be experiencing issues. Try switching to a different server by running the command `sudo apt-get update --fix-missing`.
4. Check for proxy settings: If you are behind a proxy, make sure the proxy settings are correctly configured in your system. You can check the settings by running the command `env | grep -i proxy`.
5. Wait and try again later: If none of the above steps work, the issue may be with the server that you are trying to download the package lists from. Wait for a few hours and try again later.