![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2008
Posts: 2
Rep Power: 0
![]() |
<identifier> expected error java
Hi guys, I have this code and when I try to compile and run it gives me an <identifier> expected error.
The code with the irrelevant parts taken out.
package ACCOUNT;
import java.util.Scanner;
import java.util.GregorianCalendar;
import javax.swing.*;
class Bank{
static private double bal; //Account balance
static int withdraw; //amount of times withdrawn
static void setBal(double amount){bal = amount;}
static double getBal(){return bal;}
public static void main(String[] args){
//code
}
class Charge extends Bank{
double fee = Bank.withdraw * 0.10;
double tempbal = Bank.getBal();
double amount = tempbal - fee ;
Bank.setBal(amount);
}when I run it points to the line Bank.setBal(amount) and says <identifier> expected can someone help? |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Mar 2008
Posts: 2
Rep Power: 0
![]() |
Re: <identifier> expected error java
I tried removing the private part from the variable declaration. removed the method to access the balance, since it was no longer needed and could just be accessed from the subclass using bank.bal. but it still gives me the identifier error on the line I access the bal from in the subclass
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| register_shutdown_function() not behaving as expected | grimpirate | PHP | 10 | Jan 18th, 2008 9:06 PM |
| Unqualified ID Expected? | SonicReducer | C++ | 3 | Mar 28th, 2007 6:29 PM |
| error 3 Expected end-of-statement | m0rb1d | Other Scripting Languages | 0 | Dec 12th, 2006 11:05 AM |
| error: expected primary-expression... | rup | C++ | 18 | Apr 17th, 2006 3:24 PM |
| Total noob, trouble expected? | Mudanie | Python | 18 | Oct 27th, 2005 11:03 AM |