| |

VerySource

 Forgot password?
 Register
Search
View: 6542|Reply: 34

How to see pointer address in java

[Copy link]

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-9-28 11:00:02
| Show all posts |Read mode
c:
int *p;
int i;
p=&i;
printf("%d",p);


What about java? (That is the "reference address")
Reply

Use magic Report

0

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 Egypt

Post time: 2020-9-28 11:15:01
| Show all posts
Can't see it, the virtual machine is responsible
Reply

Use magic Report

0

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-9-29 09:45:01
| Show all posts
object.toString()
Reply

Use magic Report

0

Threads

14

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 Invalid IP Address

Post time: 2020-9-29 11:15:01
| Show all posts
What's the use of watching it?
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-9-29 12:30:01
| Show all posts
Can print the hash code of the object
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Great Britain

Post time: 2020-9-29 12:45:01
| Show all posts
Object class
hashCode()
toString()
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-29 13:00:01
| Show all posts
Learn
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-9-29 13:15:01
| Show all posts
The original poster, it should be invisible in java, because java does not have pointer operations
Reply

Use magic Report

2

Threads

16

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-9-29 13:30:01
| Show all posts
This is STRING:
    public int hashCode() {
int h = hash;
if (h == 0) {
int off = offset;
char val[] = value;
int len ​​= count;

            for (int i = 0; i <len; i++) {
                h = 31*h + val[off++];
            }
            hash = h;
        }
        return h;
    }

This shouldn’t be an address, right? My purpose is to see if two objects are at the same address.
Reply

Use magic Report

0

Threads

6

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-9-29 14:30:01
| Show all posts
== Doesn't this work?
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