Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 10th, 2008, 8:42 PM   #1
chelfc
Newbie
 
Join Date: Mar 2008
Posts: 2
Rep Power: 0 chelfc is on a distinguished road
<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 is offline   Reply With Quote
Old Mar 10th, 2008, 8:42 PM   #2
chelfc
Newbie
 
Join Date: Mar 2008
Posts: 2
Rep Power: 0 chelfc is on a distinguished road
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
chelfc is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
register_shutdown_function() not behaving as expected grimpirate PHP 10 Jan 18th, 2008 8:06 PM
Unqualified ID Expected? SonicReducer C++ 3 Mar 28th, 2007 5:29 PM
error 3 Expected end-of-statement m0rb1d Other Scripting Languages 0 Dec 12th, 2006 10:05 AM
error: expected primary-expression... rup C++ 18 Apr 17th, 2006 2:24 PM
Total noob, trouble expected? Mudanie Python 18 Oct 27th, 2005 10:03 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:17 PM.

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