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

  • Home
  • SEARCH
  • 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 7935089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:49:06+00:00 2026-06-03T21:49:06+00:00

I started to write my first Java program . class HelloWorldApp { public static

  • 0

I started to write my first Java program.

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}

The program runs fine just with the above code. But according to my OOP knowledge, a class is only an abstract concept and doesn’t come to life untill you create an object of its kind. And then, through that object we call the methods/functions inside the class.

But in this particular example, it seems that main method is called even without creating an object of the class HelloWorldApp

Is the object created somewhere else? If so, how does that portion of the code know my class name HelloWorldApp?

  • 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-03T21:49:07+00:00Added an answer on June 3, 2026 at 9:49 pm

    It is because it is static method, and for that it doesn’t need to create instance

    JVM will load the HelloWorldApp class and it will invoke static method on it, And since it is public JVM (being external ) can access this method


    Also See

    • why-is-the-java-main-method-static
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I first started programming, I wrote everything in main. But as I learned,
I have started learning Java and I have 1 issue: I write a simple
When I started to write the first SQL-Statements in my programs I felt quite
I just started to write a C program converting some LaTeX into HTML code.
I want to write a Java class that will take a CSV file and
I just started with Haskell and tried to do write some tests first. Basically,
I started to write a terminal text editor, something like the first text editors
I'm an avid vim user and have started to write some SQL code recently.
I started by googling and found the article How to write INSERT if NOT
I just started with a project that requires me to write to PDF file.

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.