• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is Java derived from C++  RSS feed

 
Iain Rodgers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes or No - Is Java derived from C++?

I ask because I'm doing another exam (CIW) where the correct answer is...

I don't want to influence your answer. Just the facts please. There must be facts surely?
 
Campbell Ritchie
Marshal
Posts: 56576
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. Java is a completely different language.

It was however written to have a syntax as close as possible to the most popular languages of its day (C and C++), and probably written by people familiar with those languages rather than Pascal and ALGOL, otherwise it would have had a syntax more like Eiffel.

Did I win?
 
Campbell Ritchie
Marshal
Posts: 56576
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch.
 
Ricky Clarkson
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java takes a lot from C++, but a lot from other places too. To say it's derived from C++ sounds like it has no other influences. The question is badly worded.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the classic joke is that java is C++--.

when creating java-the-language, they (allegedly) took C++, and removed all the complicated, confusing stuff (operator overloading, multiple inheritance, and some other stuff).

However, the concept of the JVM and bytecode is a completly new concept from C/C++ (i'm not sure if it is original to java, or came from somewhere else first).

so, i think it depends on what exactly is meant by 'derived'.
 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Java is derived from C++, it learnt the mistakes of C++ while also during infulences from other languages such as smalltalk.

Much like C# is derived from Java and C++.

There is a chat of how each language is derived (influence by) other langues here:
Mother Tongues

Its intresting to note C++ has influences from simula, thus it could be said that Java is derived/influenced by simula.

G
[ April 04, 2007: Message edited by: Gavin Tranter ]
 
Iain Rodgers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ricky Clarkson:
Java takes a lot from C++, but a lot from other places too. To say it's derived from C++ sounds like it has no other influences. The question is badly worded.


Well if you study for the CIW exam using NETG material thats exactly the question they'll ask. No debate, no discussion, just choose between true or false.
 
Campbell Ritchie
Marshal
Posts: 56576
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Fred Rosenburger:
However, the concept of the JVM and bytecode is a completly new concept from C/C++
The Eiffel language (put "bytecode" in the "search" box), which dates from the mid-1980s uses the concept of "bytecode" which is later compiled to C! So the concept of bytecode may predate Java.

From Iain Rodgers:
No debate, no discussion, just choose between true or false.
So what do they think is the correct answer? We have given you the facts. Why let the facts get in the way of a nice exam question?
 
Ricky Clarkson
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well if you study for the CIW exam using NETG material thats exactly the question they'll ask. No debate, no discussion, just choose between true or false.


That doesn't stop the question from being badly worded.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ricky Clarkson:
...That doesn't stop the question from being badly worded.

Exactly. It depends on what is meant by "derived."
 
Iain Rodgers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was pretty pissed off about the question. When you do a technical subject, and you have to answer tick-boxes you expect questions that are definately true or false.

I think "derived" is quite a vague concept.

In fact this is the question being asked in the Netg material -

�Java is an object oriented language based on C++�

The answer is "true". I think "based on" is even stronger. It makes it sound as though Java is a form of C++. I queried this with the tutor but he wouldn't budge - he said it was true too.

What do you think Java folks?
 
Campbell Ritchie
Marshal
Posts: 56576
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is "based on" really stronger than "derived from?" I looked it up on www.dictionary.com and found things like:-
based on the book,
food derived from animals.
That suggests that maybe "based on" is weaker than "derived from," in which case it is correct to say that
�Java is an object oriented language based on C++�
And where does it say "derived" in the question?
[ April 04, 2007: Message edited by: Campbell Ritchie ]
 
David McCombs
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about syntactically similar, semantically different?

A good example is:

MyClass mc; //same syntax but semantically different in C++

or

Generics, which I think were purposely made to look like C++ templates, but don't act like them.

And what is wrong with operator overloading? I think it is a negative that Java doesn't allow it.
[ April 04, 2007: Message edited by: David McCombs ]
 
Iain Rodgers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a question that crops up more than once in the material, slightly re-worded.
From what I understand the question is asking if java is based on, derived from, or originates in C++.

This is the answer the tutor gave when I queried it...

Java started life as a C++ extension so its origins are very much in C++, very much like PHP starting life as a Perl extension, syntactically there are many similarities.
 
bala nannaka
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both java and c++ programming languages follow object oriented methodologies .but they are entirely different languages in programmin wise and also executing wise
 
Zheng Ron
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by IAIN RODGERS:
Yes or No - Is Java derived from C++?

I ask because I'm doing another exam (CIW) where the correct answer is...

I don't want to influence your answer. Just the facts please. There must be facts surely?


No, but they have similar syntax.
 
Iain Rodgers
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't even understand why they should ask a question like this. If there is a correct answer then knowing it is not going to make you better at any form of computing known to man.

But no doubt it will be useful if I get a job as a professor in the History of Computing faculty of the University of Academia.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe the CIW exam isn't measuring what we assume. This might not be a web certification at all -- but instead, some sort of personality inventory (like the MMPI). If so, the answers themselves have little meaning, because what matters is how your answers correlate to those provided by previously classified reference groups. (So, for example, if you answer "true" to "I like to read auto magazines," this says nothing about any interest in cars, but could be an indicator that you fit the profile of people who tended to answer that question in the same way.)

Glad I could help.
 
Tamil selvan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.

Oops!(Object Oriented).

Marc, I've changed the last name.

[ April 13, 2007: Message edited by: Tamilselvan Chandrasekaran ]
[ April 13, 2007: Message edited by: Tamilselvan Chandrasekaran ]
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Iain Rodgers:
Java started life as a C++ extension so its origins are very much in C++, very much like PHP starting life as a Perl extension, syntactically there are many similarities.

No, Java did not start as a "C++ extension", whatever you mean by that... where did you get that from?
Originally posted by Tamilselvan CS:
No.

Interesting first post, Tamilselvan. Welcome to JavaRanch.
[ April 10, 2007: Message edited by: Jesper Young ]
 
Anand Hariharan
Rancher
Posts: 272
C++ Debian VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

From Fred Rosenburger:

However, the concept of the JVM and bytecode is a completly new concept from C/C++

The Eiffel language (put "bytecode" in the "search" box), which dates from the mid-1980s uses the concept of "bytecode" which is later compiled to C! So the concept of bytecode may predate Java.


Pascal predates Eiffel by a couple of decades, and it had a notion of a "virtual machine" of sorts.


From Iain Rodgers:

No debate, no discussion, just choose between true or false.

So what do they think is the correct answer? We have given you the facts. Why let the facts get in the way of a nice exam question?


My opinion of NetG's questions is not the most flattering....


BTW, how do people quote here? I found this post difficult, and I am not even sure I got it right.

- Anand
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Tamilselvan CS,"

Welcome to JavaRanch!

Please revise your display name to meet the JavaRanch Naming Policy. To maintain the friendly atmosphere here at the ranch, we like folks to use real (or at least real-looking) names, with a first and last name. The first can be initials, but the last cannot.

You can edit your display name here. Thank you for your prompt attention!

-Marc
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anand Hariharan:
Pascal predates Eiffel by a couple of decades, and it had a notion of a "virtual machine" of sorts.- Anand

That's right. Not all Pascal compilors had it. I think that it compiled to "p-code" or something like that.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, that brings back memories. I used UCSD Pascal in a class briefly, compiled to P-Code, ran in a VM. Later I used the Pecan compiler which was a commercial offshoot of UCSD I think. Both were painful to use. Borland Pascal compiled staright to machine code and kicked butt for $49.95. I still hate to pay more than that for software.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Borland Pascal compiled staright to machine code and kicked butt for $49.95.


"Turbo Pascal"... Incredibly fast compilation. Integrated editor. And really compact generated code. They definitely don't make software like that anymore.

Henry
 
Tamil selvan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesper Young:

Interesting first post, Tamilselvan. Welcome to JavaRanch.

[ April 10, 2007: Message edited by: Jesper Young ]


Thanks, Jesper. Glad to join JavaRanch!
 
Gavin Tranter
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Henry Wong:


"Turbo Pascal"...

Henry


Ah memories, Borland Turbo Pascal was my first programming language.

"Wait until Key Pressed"
"for(1..10) do"

I do miss it
 
arpan dahal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your question is too vague. The term "derive" should not be used specially when you are trying to compare one programming language to the other. If the newer language inherits some concepts of the older language doesn't mean that the newer program is derived from the older one.
P.S. for your answer it is absolutely NO. you cannot derive any new language from the older one.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iain Rodgers wrote:This is the answer the tutor gave when I queried it...
Java started life as a C++ extension so its origins are very much in C++...

Then (as Jesper said) the tutor is wrong. Java most certainly did NOT start life as a C++ extension; it was designed as an alternative - and moreover, one that fixed a lot of the perceived "evils" of both C and C++.

That said, based on this definition of "derived from", I would say that the answer is 'true', since the language plainly has the same syntactic roots.

However,
(a) A question that requires such a complex analysis to be answered with 'true' or 'false' is terrible.
(b) I'd definitely wonder about an "exam" that includes it.

Winston
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also wonder why we are re-opening a topic that is 5 years old...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!