Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

How to access private variables in Material from DataMgt in this code. Void output returning errors

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Ranch Hand
Posts: 954
4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

public void getquantity() {
this.quantity = quantity;

}



get method should return the value not set the value. May be problem is here. I have not checked deeply.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are getting errors then you should post them in full, along with highlighting the line in your code that has the issue.
 
Marshal
Posts: 76476
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

seke mutema wrote:

Why are you importing Swing classes? You appear not to be using them here. You should keep logic and display apart, so keep all Swing code in separate classes.
Beware of that List in the constructor. You now have two references to the same object, which means that any changes outwith your class will be reflected here and vice versa. The simplest way to avoid that is like this:-
this.materials = new ArrayList(materials);
If you look up that constructor, you will see you are copying the List so you now have two separate Lists which can change independently of each other.
Why have you got a no‑arguments constructor? That permits people to create a Job instance without supplying any information. Is that what you really want?
 
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic