我有两节课:
模型/用户.java
package Model;
public class User {
public int id;
public String firstName;
public String lastName;
User( int id, String firstName, String lastName )
{
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
}
和
存储库/UserRespository.java
package Repositories;
import Model.User;
public class UserRepository
{
public User CreateUser( int id, String firstName, String lastName )
{
User newUser = new User( id, firstName, lastName );
return newUser;
}
public User GetUserById()
{
User user = new User( id, firstName, lastName );
return user;
}
}
我收到这些错误:
firstName cannot be resolved MVCExample/src/Repositories UserRepository.java line 14 1372765344696 53
id cannot be resolved MVCExample/src/Repositories UserRepository.java line 14 1372765344695 52
lastName cannot be resolved MVCExample/src/Repositories UserRepository.java line 14 1372765344696 54
The constructor User(int, String, String) is not visible MVCExample/src/Repositories UserRepository.java line 8 1372765344695 51
我究竟做错了什么?