Job oldJob = null;
Job newJob = new Job();

  • 2
    Congrats, hope we see some good rants
  • 0
    @const hope to see good !rants
  • 5
    Job job = new Job();

    There. I refactored it for you. The reference will be lost and munched up by the GC anyways.

    Cheers on the job!
  • 0
    Can you show us some constructor details?
  • 0
    How did you got this new job? Who sets variables to null? :D
  • 0
    @kpenc Java developers. It's usually not used like that though.
  • 4
    @kpenc Electron framework users on Node, since you need to have it to null for the process to stop if every window is closed :)
  • 0
    newJob.setSalary(newJob.getSalary() * 2); 🀣🀣
  • 0
    "Warning: unused variable newJob!
    Press <Alt> + <Enter> for options"
    --- Jetbrains IDEs
  • 1
    Congrats on the new job! , this is my last week in my current job as well, cheers to us!
  • 0
    @BigBoo But then you wouldn't know if I had an old job or not ☺️
  • 0
  • 1
    @cst1992 When you create a new instance of a job. It's usually a new instance. The variable name has nothing to do with it.

    But, whatever.
  • 0
    @BigBoo I know; then it'd be "Job job = new Job();" but as I said, you'd have no way of knowing if I had a past job or not. Besides, I have no objection to having the oldJob garbage collected or assigned a new instance by someone else πŸ˜‰
  • 0
    Thanks everyone ☺️ BTW, I gave my notice to the old employer and they were kind of mad at me for leaving. ☺️ Well, it's been 3 years, so that's way better than them not caring at all I guess...
Add Comment