• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't load object using objectinputstream

 
Johan Harris
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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?

 
Henry Wong
author
Sheriff
Posts: 22532
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
 
Tony Docherty
Saloon Keeper
Posts: 3138
72
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!