| |

VerySource

 Forgot password?
 Register
Search
Author: 阿迪雅

How to see pointer address in java

[Copy link]

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-29 21:00:01
| Show all posts
== is fine
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-9-29 21:15:01
| Show all posts
Check whether the object has the same memory address directly == OK
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-9-29 22:00:01
| Show all posts
==Inconvenient One is in one class, the other is in another class
Reply

Use magic Report

1

Threads

51

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-9-29 23:00:01
| Show all posts
They all use JAVA. Also consider the issue of social pointers~~Rejuvenate to the old-.-
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-9-30 01:30:01
| Show all posts
I want to judge whether the addresses of the two objects are the same. What is the use of pointers?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-30 07:00:01
| Show all posts
Then just use ==
‘==’ is based on whether their addresses are the same
Reply

Use magic Report

0

Threads

9

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-9-30 08:45:01
| Show all posts
I don't know what the original poster wants to do?
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-9-30 09:00:01
| Show all posts
I don't know what the original poster wants to do?
-------------------------------------------------- --------------
public class StringTest {
  public static void changeStr(String str){
    str="bbb";
    if (str== ???) //Here I want to compare with String str in the main function. How do I write this sentence? ?
I just wanna do this
        System.out.println("==");
  }

  public static void main(String[] args) {
    String str="aaa";
    changeStr(str);
    System.out.println(str);
  }
}
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-9-30 12:00:01
| Show all posts
No one knows
Reply

Use magic Report

0

Threads

23

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-9-30 13:15:01
| Show all posts
== compares the address of the object. do not you know?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list