• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Switch sends my class object to the trash

 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys
Heres my new problem for the night, im going to post the driver code so you can see what im trying to do. See first comment for the problem. Thank you.

 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
its asking to which account you have to deposit.
First user has to enter his account number or the system has to fetch the account details by name.


Technically,
you have to initalize local valiables.

 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not initializing the variable acct1 anywhere in your code, so Java will complain when you try to use the variable (in lines 33 and 34).

You need to initialize it, by creating a new Account object somewhere and assigning it to the variable. For example:

 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said yesterday.

Make sure your declarations have the correct scope.
I think at this stage you are getting a method which is much too large. Try this, or something similar:Now you have got your method down to a manageable size, and the action takes place elsewhere.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic