Address operator in JAVA?


 
Thread Tools Search this Thread
Top Forums Programming Address operator in JAVA?
# 1  
Old 03-16-2012
Address operator in JAVA?

Hi friends,
I hope u r doing well. Please have a look at my code, you will get my qestion.

In C language,


Code:
 
#include <stdio.h>
 
int main()
{
        int x = 10;
 
        printf("%d\n", &x);     // print address of the variable x
 
        return 0;
}

In Java,

Code:
 
public class Java_Practise
{
         public static void main(String args[])
         {
                int x = 10;
 
                System.out.printf("%d\n", &x);    // Gives error
         }
}

How can I see the address of a variable in Java???

Thanks in advance!
# 2  
Old 03-16-2012
You don't. Java is not supposed to give it to you. Java is of a completely different design than C++, partly to prevent the kind of errors which can be caused by careless pointer use.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

2. IP Networking

Tracing a MAC address to IP address: Solaris

Hi there I lost connectivity to one of our remote systems and when I checked the messages log I found the following: Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1 Aug 16 13:20:51 host... (9 Replies)
Discussion started by: notreallyhere
9 Replies

3. UNIX for Dummies Questions & Answers

Panic kernal-mode address fault on user address 0x14

:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message: PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14 KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD) EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies

4. Programming

substitute for java '+' operator in c or c++

could some one suggest me the substitute for java's + operator for concatenating two strings in c and cpp language:confused: (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

5. IP Networking

How to Achive IP address through MAC(Ethernet) address

Hi sir, i want to make such programe which takes MAC(Ethernet) address of any host & give me its IP address....... but i'm nt getting that how i can pass the MAC address to Frame........ Please give me an idea for making such program... Thanks & regards Krishna (3 Replies)
Discussion started by: krishnacins
3 Replies
Login or Register to Ask a Question