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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:59:57+00:00 2026-06-05T20:59:57+00:00

Sorry for the horrendous question, don’t know how else to describe it, I’m naturally

  • 0

Sorry for the horrendous question, don’t know how else to describe it,

I’m naturally a PHPer and i’m currently looking over some java and come across this section. The first line is just there for context, it is the line starting with QuotaKey that I’m interested in.

Key key = Keys.getKeyInstance( Keys.getKeyClass( cond.getKey( ) ) );  
QuotaKey quotaKey = ( QuotaKey ) key;
  • 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-05T20:59:59+00:00Added an answer on June 5, 2026 at 8:59 pm

    Assuming that QuotaKey is a subclass of Key, you are looking at a cast operator that converts a variable of the type Key to a variable of type QuotaKey. You can write the same fragment more succinctly without a temporary variable:

    QuotaKey quotaKey = (QuotaKey)Keys.getKeyInstance(Keys.getKeyClass(cond.getKey()));
    

    This operation checks for the key to be of the correct type before coercing its type to subclass, and cause ClassCastException on failures. It is a good idea to minimize the number of such casts in your program, because their validity cannot be reliably checked at compile time.

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

Sidebar

Related Questions

Sorry, I know this question is easy, but I don't know how to get
Sorry for asking a question about something I don't know much about, but I've
Sorry for the vague title, I didn't know how else to phrase this. Suppose
Sorry for the crappy title - didn't know how else to say it. I
Sorry. I don't know a good title for this, but please look here: http://joshblog.net/projects/logic-gate-simulator/Logicly.html
Sorry, not really programming question, but I am not sure where else I could
Sorry I can't find a question answering this, I'm almost certain someone else has
Sorry gals & guys for a potentially dumb question but I have been looking
Sorry didnt know who to formulate the question best, but i will try to
Sorry for question but I can't find answer anywhere on internet. I couldn't find

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.