1

This is the class and it's constructor that I made. No problems while compiling.

public class Usuario
{
    private String usuario="a";
    private String contrasena="a";
    private String nombre="a";
    private String apellido="a";
    private int dni=0;
    private int edad=0;

    public Usuario (String usuario, String contrasena, String nombre, String apellido, int dni, int edad)
    {
        this.usuario=usuario;
        this.contrasena=contrasena;
        this.nombre=nombre;
        this.apellido=apellido;
        this.dni=dni;
        this.edad=edad;
    }

And this is my main code where I use the constructor.


    public class userTest
    {
        public static void main (String args[])
        {
            Usuario philip;

            philip=new Usuario (user987, pass123, Philip, Fry, 11000111, 21);

        }
    }

When compiling this part, the javac shows that error.


1
  • Shows what error? For what symbol? Commented May 17, 2020 at 4:42

1 Answer 1

1
philip=new Usuario (user987, pass123, Philip, Fry, 11000111, 21);

The first 4 parameters are not defined.

If you are attempting to pass String values to the constructor, then the code should be:

philip= new Usuario ("user987", "pass123", "Philip", "Fry', 11000111, 21);  
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.