• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic