File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Switch sends my class object to the trash Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Switch sends my class object to the trash" Watch "Switch sends my class object to the trash" New topic
Author

Switch sends my class object to the trash

Bryce Heath
Greenhorn

Joined: Sep 16, 2011
Posts: 19
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

Joined: Feb 18, 2008
Posts: 289

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.


-Chiru
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14268
    
  21

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:


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39396
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Switch sends my class object to the trash