Click to See Complete Forum and Search --> : c++ & java
[praetorian]
Aug 23rd, 2001, 05:15 PM
hello!
I'm learning c++ now and after I've got to know it a bit, I was thinking of learning Java. What I want to know if it is a big step from c++ to java? Is java quit heavy to learn as c++?
thanks!
filburt1
Aug 23rd, 2001, 05:25 PM
Java is actually much easier than C++. No pointers and other complex C++ concepts. But Java introduces multithreading and many other new concepts.
[praetorian]
Aug 23rd, 2001, 05:27 PM
so, going from c++ to java wouldn't be too difficult you mean?
filburt1
Aug 23rd, 2001, 05:32 PM
Not that bad. Java was based on C++. As long as you don't program in C++ like in C (i.e., you haven't created classes, you use char arrays instead of Strings, etc), then everything should be cool. Get a good book, especially one by Sams Publishing.
Dillinger4
Aug 23rd, 2001, 11:09 PM
Heres some diffrences between C and Java just so you can take a look.
No preprocessor directives: Java treats constant definitions as
static final fields.
No global variables: Java defines an extreamly clean namespace.
Packages contain classes, classes contain methods and fields methods contain variables. Thus there is no possibility for namespace collisions.
Well-defined primative type sizes:
All the primative types in Java have well defined sizes. In C, the size of int, short ,long types is platform dependent, which hampers portability.
Foward References: The Java compiler is smarter then the C compiler in it allows methods to be invoked before being defined. This elimates the need to define function in a header file before defining them in a program file, as is done in C.
No method pointers: C allows the programmer to store the address of a function in a variable and pass that function pointer to other functions. You cannot do this with java methods but you can acheive similiar results by passing an object that implements
a particular interface.
Variable declarations anywhere: C only permitts local variable declarations to be at the beginning of a method or block. Java allows the variable declarations anywhere
within a method or block. --NOTE-- most programmers perfer to keep variable declarations at the top of a block or method however.
Garabage Collection: The Java Virtual Machine performs "Garabage Collection" or
deallocation of memory automatically. This elimates the need for Java programmers to explictly manage memory used by all object and arrays. For instance an object is
eligible for garabage collection if there are nolonger any variables that hold a refrence to that object.
Method overloading: Java programs can define multiple methods with the same name as long as the methods have diffrent parameter lists.
Wynd
Aug 23rd, 2001, 11:58 PM
Dilenger, do you have that saved on your computer? :D
sail3005
Aug 24th, 2001, 12:04 AM
JAVA IS NOT BASED ON C++!!
Dillinger4
Aug 24th, 2001, 12:37 AM
Actually yes i do have that saved. But i do remember most of it though. It is one of the most asked questions sometimes so i keep it handy.
filburt1
Aug 24th, 2001, 07:54 AM
Originally posted by sail3005
JAVA IS NOT BASED ON C++!!
I did a report on it at school for an entire year, and I have worked professionally with Java for two years. Trust me, it was designed to fix the problems of C and C++.
sail3005
Aug 24th, 2001, 10:51 AM
Java was not designed to fix all the problems of c++. It's main goal was to be a portable language, that could go from computer to computer. The syntax may have some sililarities, but you will see those in any oop language. That doesn't mean they are based off of eachother.
filburt1
Aug 24th, 2001, 01:00 PM
The cross-platformness was the second goal. Making it a better C++ also included the cross-platformness that compiled C++ and even some source C++ lacks.
Dillinger4
Aug 24th, 2001, 02:03 PM
I think what the sun developers had in mind when developing Java was making it so C++ programmers wanting to migrate to Java would feel somewhat comfortable with the syantax.
sail3005
Aug 24th, 2001, 04:01 PM
exactly. which is entirely different than basing a language off of another language. C++ for example, was made to improve C, and make it an OO language, and C++ is based off of C.
Java and C++ are completely different. If you see a similarity, it is probably the syntax, because they are both OO languages.
Randy_Bartels
Aug 25th, 2001, 03:55 PM
java was designed to be the successor of C++ but was bought by Sun and hacked into a interpreted language
Randy_Bartels
Aug 25th, 2001, 03:57 PM
here is teh defintion of java from webopedia:
A high-level programming language developed by Sun Microsystems. Java was originally called OAK, and was designed for handheld devices and set-top boxes. Oak was unsuccessful so in 1995 Sun changed the name to Java and modified the language to take advantage of the burgeoning World Wide Web.
Java is an object-oriented language similar to C++, but simplified to eliminate language features that cause common programming errors. Java source code files (files with a .java extension) are compiled into a format called bytecode (files with a .class extension), which can then be executed by a Java interpreter. Compiled Java code can run on most computers because Java interpreters and runtime environments, known as Java Virtual Machines (VMs), exist for most operating systems, including UNIX, the Macintosh OS, and Windows. Bytecode can also be converted directly into machine language instructions by a just-in-time compiler (JIT).
Java is a general purpose programming language with a number of features that make the language well suited for use on the World Wide Web. Small Java applications are called Java applets and can be downloaded from a Web server and run on your computer by a Java-compatible Web browser, such as Netscape Navigator or Microsoft Internet Explorer.
Dillinger4
Aug 25th, 2001, 04:46 PM
Exactaly. There is no doubt java being an easier language to learn. But alot of the complexities are taken out of java. For instance Java does not support multiple class inheritance such as C++ does. Java though does support multiple interface inheritance.
Randy_Bartels
Aug 25th, 2001, 04:52 PM
ever try smalltalk?
Dillinger4
Aug 25th, 2001, 07:39 PM
Nope, All i know about smalltalk is that it was developed by XEROX at the PARC(Palo Alto research center). I would like to know more about it though.
sail3005
Aug 25th, 2001, 09:15 PM
What is it?
Randy_Bartels
Aug 25th, 2001, 09:18 PM
An object-oriented operating system and programming language developed at Xerox Corporation's Palo Alto Research Center. Smalltalk was the first object-oriented programming language (Simula was the very first). Although it never achieved the commercial success of other languages such as C++ and Java, Smalltalk is considered by many to be the only true object-oriented programming environment, and the one against which all others must be compared.
Dillinger4
Aug 25th, 2001, 09:21 PM
Hummmmm interseting. But which language came first?
Smalltalk was the first object-oriented programming language (Simula was the very first).
You confused me there. :p
Randy_Bartels
Aug 25th, 2001, 09:25 PM
Simula
sail3005
Aug 25th, 2001, 09:32 PM
So, is smalltalk still used commercially today?
Randy_Bartels
Aug 25th, 2001, 09:38 PM
IBM makes smalltalk development tools so i would think so
sail3005
Aug 25th, 2001, 09:43 PM
thats cool, i am gonna look into it.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.