• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help to set a string value using a setmethod if condition is true  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to java and need some help. I want to set a string value called "LMP LIMITED" using a setMetho if it passed an if statement.

I have two files called company.java and companyDetails.java

I have the following method in company.java file

now in my companyDetails.java file,

I have a if statement that checks if stupplier varified and if it is then return the name of the supplier which is LMP Limited. From the basic knowledge I have, I implemented the following code:
 
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by zub kodi:
...I get an error cannot resolve symbol method setSupplier(java.lang.String)...

What is the type of "companyInfo"? The type of this reference should be the class in which the method "setSupplier" is defined. (Or if you are overriding the method, it could also be a supertype of that class.)

I see that setSupplier is in the file company.java, so I might assume that the class is also "company." But whatever that class is called, that should be the type of the variable "companyInfo."
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Mark pointed it out,check the type of the variable "Company info"

and also check that you have written a method setSupplier which takes a String as parameter.

You might have written setSupplier with any other paramater.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!