• 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

Can't load object using objectinputstream

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Obviously this is part of an assignment, and I'm very afraid there might be some serious beginner mistakes involved.
This is supposed to be a apartment booking system. What I want to do is to save a counter, in this case counting how many rooms is occupied from any of the three apartment types; aptA, aptB and aptM. To make this work I need to be able to store and load these values everytime the program starts.
Right now I have come to the point where I'm not getting any error or exceptions when I run the code, which would be an orgasmic feeling if it weren't for the fact that it isn't really loading anything, as far as I can see...

Eclipse gives me a hint though:

It says that "the value of the local variable apartment is not used".

What am I doing wrong? I have been looking at this for over a week, trying to figure it out, obviously without success. Is there any other ways of doing what I want to do, that might be a better solution to the problem?

 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Johan Harris wrote:
Eclipse gives me a hint though:

It says that "the value of the local variable apartment is not used".



The warning is pretty clear. You are declaring a (local) variable named apartment -- and you are not using the variable anywhere in the method. Basically, eclipse is saying "why do you need to store the returned value from the method, when you are not going to use it again"?

Henry
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

As well as what Henry has said you need to look at your code and decide if so much of it should really be static. Also the constructor is assigning class variable values to the local parameter variables - are you sure this is what you intended.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic