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 4026908
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:01:50+00:00 2026-05-20T11:01:50+00:00

In Java all classes are loaded into the JVM dynamically, upon the first use

  • 0

In Java all classes are loaded into the JVM dynamically, upon the first use of a class.

Does it mean if i have class in a my source file and I do not make any reference to it then its Class object is not created (i.e. .class file is not created)?

In the sample code below iam not making a refernce to test3 class but still its class object gets created.

class test1 {
    static {
        System.out.println("static block of test1");
    }
}   
class test2{
    static {
        System.out.println("static block of test2");
    }
}
class test3 {}
class MyExample1 {
    public static void main(String ...strings ) {
    new test1();
    new test2();
    }
}

Why test3.class file gets created?

  • 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-05-20T11:01:51+00:00Added an answer on May 20, 2026 at 11:01 am

    .class file was created at compilation time. But, it will be loaded from .class file by first usage (probably).

    From where it should be loaded without .class file?)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a java class used as an entity that has 2 classes that
Actually I have two java classes of which one is an activity class. Now
In Java there are methods to go about scanning the classpath/all classes/within a package
Are all final classes in Java immutable. String and Integer both are final classes
Using reflection on Java classes to access all field, methods, and so on: Is
i know that the JDK consists of all java packages .But what does the
First of all this is the first time I am asking a java question
I have a grails project with some additional java source files under src/java folder.
I have read a lot about the Java class loading process lately. Often I
Is there a way to check if all boot (core) java classes (belonging to

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.