Search code examples
javaandroidgetter-setter

Getters and setters not working in android


package com.location.location;

/**
 * Created by user on 14-12-2015.
 */
public class UserDetailsTable {

    String firstName,lastName,userName,password;

    public UserDetailsTable(String firstName, String lastName, String userName,
                            String password) {
        super();
        this.firstName = firstName;
        this.lastName = lastName;
        this.userName = userName;
        this.password = password;
    }

    public UserDetailsTable() {
        super();
        this.firstName = null;
        this.lastName = null;
        this.userName = null;
        this.password = null;

    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() { return lastName; }

    public void setLastName(String lastName) { this.lastName = lastName; }

    public void setUserName(String userName) { this.userName = userName;  }
    public String getUserName() { return userName; }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

}

I dont know where i am going wrong.... i get three values out of four arguments...the arguments which i get is firstname, lastname,and password, for username the setter method setuserName says "Method Setter is never used" I know this is foolish but I don't see any way out of this.... Please help...


Solution

  • First of all, constructors shouldn't have super(); since the class doesn't extend another one.

    next your setter/getter are case sensitive . Try calling setUserName instead