aspose 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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 288

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: 13870
    
  10

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 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
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
 
Similar Threads
Having troubles with a complex program, need help with an illegal start of type error.
Just Can't figure it out and it's due today
Scanner Strings and Ints dont play nice
Need help with username and password validation
Bank program class or switch problem