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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:12:54+00:00 2026-05-19T14:12:54+00:00

Assume that there is a class like the following. public Class SomeClass { private

  • 0

Assume that there is a class like the following.

public Class SomeClass {
    private A getA() {
        ...
    }

    public void show() {
        A a = getA();    // CASE #1
        ...
    }

    public void show2() {
        A a = this.getA();    // CASE #2
        ...
    }

Their result are same, isn’t? My idiot co-worker insisted that’s right!!(it means they’re different.)

  • 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-19T14:12:55+00:00Added an answer on May 19, 2026 at 2:12 pm

    They’re the same in this context. I’d advocate not using this since it’s implied and it’s just cluttering up the code by being there, but it makes no practical difference whether it’s there or not.

    It’s not useless though. The this keyword is required sometimes, for instance:

    • When a local variable / parameter hides a field it’s used to differentiate between them
    • When referring to the outer instance of a class from the inner instance (use Outer.this)
    • When using explicit generic types to call a method rather than just infered types (you can’t just do <String, String>stringMethod(), it has to be this.<String, String>stringMethod().

    That’s by no means an exhaustive list, just serves as an example to demonstrate while it doesn’t make a difference in this case, it can do in other cases!

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

Sidebar

Related Questions

Assume that I have a class that exposes the following event: public event EventHandler
Let's suppose that I have the following class which tries to be immutable public
I have a static method like this public static string DoSomethingToString(string UntrustedString) { //parse
Ok, So I have the following situation. I originally had some code like this:
I've read a few posts on this, but there's still one thing that's not
I have a BankAccount model class that contains data like account number, bank name,
Say you have a C++ class like: class Foo { public: virtual ~Foo() {}
When reading from a IO::Socket::INET filehandle it can not be assumed that there will
Let's assume I have a model called product. Let's assume that product has three
Assume that we have N erlang nodes, running same application. I want to share

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.