Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   <identifier> expected error java (http://www.programmingforums.org/showthread.php?t=15385)

chelfc Mar 10th, 2008 8:42 PM

<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?

chelfc Mar 10th, 2008 8:42 PM

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


All times are GMT -5. The time now is 4:06 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC