Results 1 to 3 of 3
Thread: No main methods ?
- 04-21-2012, 05:23 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 5
- Rep Power
- 0
No main methods ?
Hello everyone.
Here is my problem, I wrote this this morning for my beginner Java class (pun unintended :P) but for some obscure reason eclipse won't compile it claiming that there aren't any main method
anyone can help me out on that please ?
Java Code:import java.util.Date; public class Account { public void main(String[] args) { Account account = new Account (1122, 20000 ); setannualInterestRate (4.5); withdraw (balance, 2500 ); deposit (balance, 3000); System.out.println ("The balance of the account " + id + " is " + getbalance() + " with a monthly rate of " + getMonthlyInterestRate(annualInterestRate) + " starting " + getDate () + "."); } private int id = 0; private double balance = 0; private double annualInterestRate = 0; private Date dateCreated = new Date (); public Account (){ } public Account (int id, double balance){ } public Date getDate(){ return dateCreated; } public double getbalance (){ return balance ; } public void setbalance (double balance){ this.balance = balance; } public double getannualInterestRate (){ return annualInterestRate; } public void setannualInterestRate (double annualInterestRate){ this.annualInterestRate = annualInterestRate; } public int getid (){ return id; } public void setid (int id){ this.id = id; } public double getMonthlyInterestRate (double annualInterestRate){ double monthlyInterestRate = annualInterestRate/12; return monthlyInterestRate; } public double withdraw (double balance, double withdrawn){ balance -= withdrawn; return balance; } public double deposit (double balance, double deposited){ balance += deposited; return balance; } }
- 04-21-2012, 05:25 PM #2
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
Re: No main methods ?
void main needs a static modifier
- 04-22-2012, 03:16 AM #3
Member
- Join Date
- Mar 2012
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
how can main call other methods?
By rahuld.exe in forum New To JavaReplies: 1Last Post: 04-06-2012, 01:19 PM -
calling methods into my main seems to be my first problem
By vcardell in forum New To JavaReplies: 9Last Post: 11-18-2011, 10:47 PM -
compile error - calling methods from main
By counterfox in forum New To JavaReplies: 1Last Post: 04-16-2010, 05:00 PM -
Classes and main methods?
By CyberFrog in forum New To JavaReplies: 17Last Post: 05-26-2009, 04:47 AM -
[SOLVED] Mulitple main methods
By MuslimCoder in forum New To JavaReplies: 6Last Post: 02-10-2009, 01:49 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks