Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hamish Jones   on Nov 17 In Java Category.

  
Question Answered By: Paul Brooks   on Nov 17

Though java  and C++ are quite similar, they have a lot of
differences too. The basci idea is in java we don't have pointers.
i.e. we can't have '->' as in C++.

Look, In java alot of things have been standarised. For example.
1. In java, if we say

Object obj;
// this means obs is REFERANCE to an object of type Object.

i.e. all identifiers in java are refernces. except for Primitive
types (like int, boolean, etc.)
but in C++, u have two mechanism.
1. ur identifier may be representing the object itself e.g
Object obj;
2. ur identifier may be refering to the object. e.g
Object *obj;

In a real life we use object reference for implementation (in C++)
since otherwise method calling might be expensive.

As far as String class  is concerned, It is higly used class, so a
sortcut has been provided by instantiation without calling the new()
keyword.

U can look into a java book by Bruce Eckle [Thinking in Java]. After
reading this book, u will now what's diff. between java and C++? why
those differences? etc.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Instantiation Or get search suggestion and latest updates.


Tagged: