Ok.. A very noob question.
This is my first attempt to write a class in java.
I created a project (Bank), a package (bank), and two classes Account, and Driver
So, my project looks like:
Bank --> src-->bank --> Account.java --> Driver.java
Now Driver.java has main.
How do i call Account.java class from Driver.java
I have included package bank on both the files.
Account myAccount = **Account**("foobar",12345); bold is where the error is.
It is not being able to find Account class.
Thanks
In Java you create objects by using the keyword
newAs a sidenote:
If all your classes are in the same package you don’t need to import them, but if you had
Accountin another package then you would have to import it by usingAnother sidenote as you continue to learn, not really related to this question:
If you were only to call a
static methodinAccount.java, you wouldn’t need to create an object. You would go like: