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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:34:27+00:00 2026-06-12T19:34:27+00:00

This is, perhaps, a stupid question, but I’ve found nothing on it elsewhere. I’m

  • 0

This is, perhaps, a stupid question, but I’ve found nothing on it elsewhere. I’m going through the basics of Android, and when I try to create an intent specifically to run another activity of my choosing, the tutorial tells me to construct it this way:

Intent intent = new Intent(this, DisplayMessageActivity.class);

Where “DisplayMessageActivity” is the class for the activity I’m running. What I don’t get is, what’s the “.class” part? That parameter, as I understand it, is supposed to be a Class object. Is “class” a field of my Activity subclass? Or when I say “DisplayMessageActivity.class”, am I referring to an actual .class file (that seems a little weird)?

Any help is appreciated!

  • 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-12T19:34:30+00:00Added an answer on June 12, 2026 at 7:34 pm

    While the .class appears to be a normal field access, it is actually a special language construct, that is explained very well in the Retrieving Class Objects Java tutorial.

    It says, quote:

    If the type is available but there is no instance then it is possible to obtain a Class by appending “.class” to the name of the type. This is also the easiest way to obtain the Class for a primitive type.

    And they give the example:

    boolean b;
    Class c = b.getClass();   // compile-time error
    
    Class c = boolean.class;  // correct
    

    In my day to day usage of Java, this isn’t a hugely used construct, and many are unaware of it. Generally it’s used with generics and the like when specificing classes in general rather than instances of them.

    I hope this helps. 🙂

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

Sidebar

Related Questions

This may sound like a stupid question, perhaps it is. But I'm only trying
Perhaps this question has been asked elsewhere, but I'm unable to find it. With
This question may seem like a novice, and perhaps 'stupid' question but please bear
Perhaps a stupid question, but what exactly is the purpose of this Delphi folder?:
Perhaps this is a stupid question, but I'm trying to use BGL's dijkstra_shortest_paths ,
This is perhaps more of a discussion question, but I thought stackoverflow could be
I have an ObjectDataSource (but perhaps this question is the same for all kinds
OK, this is perhaps stupidest question ever but bear with me.... How to make
Perhaps a stupid question, but assuming base class A defines a virtual method V
This may turn out to be an embarrassingly stupid question, but better than potentially

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.