Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8617939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:59:22+00:00 2026-06-12T05:59:22+00:00

Ok.. A very noob question. This is my first attempt to write a class

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:59:23+00:00Added an answer on June 12, 2026 at 5:59 am

    In Java you create objects by using the keyword new

    Account myAccount = new Account("foobar",12345);
    

    As a sidenote:
    If all your classes are in the same package you don’t need to import them, but if you had Account in another package then you would have to import it by using

    import path.to.package.Account;
    

    Another sidenote as you continue to learn, not really related to this question:
    If you were only to call a static method in Account.java, you wouldn’t need to create an object. You would go like:

    Account.mymethod()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am complete Java noob and this question will be very easy. I did
This might sound like a noob question but this is the first time I'm
Hi there this might me a very noob question but I'm stuck, and I'm
First : I'm very noob at this. Sorry. I want to learn. My website
This is basically a very noob question about Ruby console (IRB), but I couldn't
I'm sorry for this ( probably very ) noob question, but i've been asked
I am very noob to this URL rewrite. just got a question in my
I feel like this is a very noob question.. but I just can't get
This might be a very noob question, but I can't seem to find the
first of all I am very new (noob). Probably my question is very stupid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.