0
public class Client {
    private String idNum;
    private int driverLicence;
    private String name;
    private String surname;
    private String mailAddress;
    private String address;
    private int phoneNum;
    
    
    public Client(String idNum, int driverLicence, String name, String surname, String mailAddress, String address, int phoneNum) {
        this.address=address;
        this.driverLicence=driverLicence;
        this.idNum=idNum;
        this.mailAddress=mailAddress;
        this.name=name;
        this.phoneNum=phoneNum;
        this.surname=surname;
    }


    public String getIdNum() {
        return idNum;
    }


    public void setIdNum(String idNum) {
        this.idNum = idNum;
    }


    public int getDriverLicence() {
        return driverLicence;
    }


    public void setDriverLicence(int driverLicence) {
        this.driverLicence = driverLicence;
    }


    public String getName() {
        return name;
    }


    public void setName(String name) {
        this.name = name;
    }


    public String getSurname() {
        return surname;
    }


    public void setSurname(String surname) {
        this.surname = surname;
    }


    public String getMailAddress() {
        return mailAddress;
    }


    public void setMailAddress(String mailAddress) {
        this.mailAddress = mailAddress;
    }


    public String getAddress() {
        return Address;
    }


    public void setAddress(String address) {
        this.address = address;
    }


    public int getPhoneNum() {
        return phoneNum;
    }


    public void setPhoneNum(int phoneNum) {
        this.phoneNum = phoneNum;
    }

    
    
}

THE VALUE OF THE FIELD Client.idNum IS NOT USED

for some reason i am getting this kind of error on every field i have written on this class ALL getters and setters are generated from eclipse and all my other classes are fine but for some reason this specific class gives this "error"

i have wasted a lot of time on this and can't seem to find the reason why this happends

any ideas?

  • 2
    Are you sure it's an error and not just a warning? If it's a warning, then I imagine that as you write more code that uses your class, the warnings will go away. – khelwood Jun 24 '20 at 22:12
  • Not related to your question but variable names should NOT start with an upper case character. – camickr Jun 24 '20 at 22:20
  • This isn't the problem, but java methods and variables typically start with lower case letters (address), whereas java classes start with upper case letters. – NomadMaker Jun 24 '20 at 22:21
  • yeah i forgot about the uppercase there. As for my problem, sorry i didnt describe it the right way. Its a WARNING not an error. but for some reason this pops up only in this class even though every field of my other classes are private as well – Makaveli Shakur Jun 24 '20 at 22:26
  • What exactly is giving this warning? What does it look like, exactly? It's not the Java compiler, presumably. You may be running things like Checkstyle but you haven't told us about that. – Erwin Bolwidt Jun 24 '20 at 22:56

1 Answers1

1

I copy pasted my code in, and an issue that may be causing your problem is that the code below returns the incorrect instance variable. Your instance variable is "address" not "Address".

public String getAddress() {
    return Address;
}
Madhu Sharma
  • 562
  • 4
  • 9