🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #542

java semantics vs C++

#542
From: Ihug
Date: Sun, 20 Aug 2000 00:00
34 lines
1484 bytes
Hi,

    I am new to Java and coming from a C++ background ...... I have my
trusty Java books in hand. The similarity to C++ is obvious, but I m a
little confused about some of the logistics behind Java.

For example
when I declare an instance of an object in Java

class obj
{
    obj ()
    {
        // obj construct
    }
    // some methods
}

public static void main(String []arguments)
{
    obj x = new obj();
}
now is the new operator explicitly asking for memory ?..... and is x a
pointer of my type obj ?....
or does new have a total different meaning in Java ?

If so then what is the difference if I have
obj x;
 // or
obj y = new obj();

Thankyou if you can help.

T
Technical Details
Message-ID: <966728868.782876@ns2.1earth.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d6db,d85a1064ac7a86a7,start
X-Google-Attributes: gid10d6db,public
From: "Ihug" <sammuel@ihug.com.au>
Subject: java semantics vs C++
Date: 2000/08/20
Message-ID: <966728868.782876@ns2.1earth.net>
X-Deja-AN: 660225066
Cache-Post-Path: ns2.1earth.net!unknown@p22-max4.wgg.ihug.com.au
X-Trace: nsw.nnrp.telstra.net 966728863 203.132.224.15 (Sun, 20 Aug 2000 09:47:43 EST)
Organization: Ye 'Ol Disorganized NNTPCache groupie
X-MSMail-Priority: Normal
X-Priority: 3
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
NNTP-Posting-Date: Sun, 20 Aug 2000 09:47:43 EST
Newsgroups: aus.computers.java
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Complaints-To: abuse@telstra.net