Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Key difference between Java and C++  RSS feed

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was attending an interview last month. The interviewers asked me to list the differences between C++ and Java. I gave garbage collection, lack of pointers, portability etc. Then one of the interviewers asked me to pick one difference which I think clearly distinguishes Java from C++.
I answered C++ as the object orientation given to C language where as Java to be more object oriented. But the interviewer seemed to have different answer in mind.
I would like to know the opinion of fellow ranchers. What do you consider the key difference between Java and C++? If not the degree of support for object orientation, what else do you think clearly separates Java from C++?
Thanks in advance,
Ramesh
 
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Platform independance.
That is the BIG BANG that you get out of Java that C++ does not have.
 
Ranch Hand
Posts: 411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn't this the same as 'portability'?
 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You would think it is the same, but sometimes people giving interviews like to think they know something you don't.
Like the dumb@$$ teachers who like to test you for the exact words they gave in a lecture without regard for the concept of the subject matter.
I had some guy in a technical interview ask me the difference between a sub-routine and a function. Then think he was all smart when he was giving his answer, stupid VB programmer.
People don't want the best answer, they want their answer.
 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Curious: What was his answer? My first thought was "the name" although I know that would be considered wrong.
Paul R
 
Andrew Shafer
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If you are asking me, his answer:
A function must return a value, a sub-routine must not.
I went home and the first book I opened cleary stated subroutine and function are can be interchanged. Maybe there exists some archaic CS book with these definitions, but certainly not the general usage.
This interview was about a year ago.
Ahh, java, everything is called a method.
 
author
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've alway judged good programming skills based on liguistic nuances such as that. Everyone can understand programming concepts and utilized their career experience, but to be able to distinguish and debate the difference between a pointer and a memory address, for instance ..... wow. Give that guy a signing bonus!
Sean
 
Ramesh Donnipadu
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew,
Probably your interviewer did lots of Fortran Coding. In Fortran, subfunctions return values but subroutines don't.
-Ramesh
 
Andrew Shafer
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

It wasn't the question or the answer, it was the smug way he thought he knew what he was talking about.
I'm always try to admit when I don't know something and love to learn from people who know more than me.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[This message has been edited by Cindy Glass (edited May 30, 2001).]
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
class Individual extends Human implements AttractAttentionEffort {
public void main (String args[]) {
Individual Cindy = new Individual("Cindy Glass");
AttractAttentionElement[] cindysAAElements;
cindysAAElements[0] = new DrawAttentionElement("farce");
cindysAAElements[1] = new DrawAttentionElement("cleverness");
Cindy.AttractAttention(cindysAAElements);
Individual "me" = new Individual(myName); //compilation error
AttractAttentionElement[] myAAElements;
myAAElements[0] = new DrawAttentionElement("moreFarce");
myAAElements[1] = new DrawAttentionElement("moreClevernessClaim");
"me".AttractAttention(myAAElements);//I'm as
//fool as cindy
//i like u cindy..
//i dont know why i did this cindy..
//forgive me cindy.... i implement AttractAttentionEffort..
//(really cool..)
}
}
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gee sorry. I was just feeling silly.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!