Starting java with C++ background

A

Afshin

Hello everybody

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started. In the past,
I used to work with Visual C++ 5.0 and 6.0 and have recently switched
to Visual Studio 2005. I see there is a Visual J# available out there.
Is it the right place to start?

Many thanks for any comments.

Afshin
 
L

Lew

Afshin said:
Hello everybody

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started. In the past,
I used to work with Visual C++ 5.0 and 6.0 and have recently switched
to Visual Studio 2005. I see there is a Visual J# available out there.
Is it the right place to start?

No, because "J#" is not Java.

Start at
<http://java.sun.com/>
and read the tutorials
<http://java.sun.com/developer/onlineTraining/>
in particular
<http://java.sun.com/docs/books/tutorial/index.html>

That last page has a link entitled "The Really Big Index" that's worth
following after that.
 
I

Ian Wilson

Afshin said:
Hello everybody

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started. In the past,
I used to work with Visual C++ 5.0 and 6.0 and have recently switched
to Visual Studio 2005. I see there is a Visual J# available out there.
Is it the right place to start?

This question is frequently asked, I suggest you use Google Groups to
search comp.lang.java.* for previous discussion of this.


A brief and incomplete recap:

AFAIK VS2005 is an IDE, IDEs for Java include

Eclipse. http://www.eclipse.org. Open-Source. Free download.
Netbeans. http://www.netbeans.org. Open-source. Free download.
JBuilder. http://www.codegear.com/products/jbuilder. Commercial.
.... many others

I use Eclipse.
Netbeans includes a visual GUI editor called Matisse.

Good tutorials are available at http://java.sun.com/docs/books/tutorial/

Java comes in several editions, start with the standard edition. The
other editions are for mobile devices and for enterprise applications
(e.g. web-services, JSP etc)

Most people advise you to start with console applications (non-GUI) and
only progress to GUI once you've mastered the initial problems people
have with classpaths etc.

Java has several GUI toolkits. For example AWT, Swing and SWT. I suggest
you try Swing first. Learn about pluggable "Look and Feel". Learn how to
use Layout Managers. Find out about third party GUI libraries like JGoodies.

Converting from language A to B is usually hindered by the fact that
paradigms in A cannot be directly translated to B, You have to unleard
A's paradigms first and then learn B's paradigms.
Interfaces not Multiple Inheritance.
References not pointer arithmetic.
...

I'd buy some good books. I like books by O'Reilly, e.g. "Learning Java".
There's a downloadable book "Thinking in Java" by Bruce Eckel, often
recommended.
 
R

rossum

Hello everybody

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started. In the past,
I used to work with Visual C++ 5.0 and 6.0 and have recently switched
to Visual Studio 2005. I see there is a Visual J# available out there.
Is it the right place to start?

Many thanks for any comments.

Afshin
J# is not Java, and not well supported by Microsoft - it is only there
as a migration from Microsoft's J++ (now withdrawn) to C#. It is
basically a J++ syntax front end for the .Net Virtual Machine. J++
worked to the Java Virtual Machine.

If you want a Visual Java style IDE then try JBuilder from Borland.
The basic edition is free.

rossum
 
M

Mike Schilling

rossum said:
J# is not Java,
True.

and not well supported by Microsoft - it is only there
as a migration from Microsoft's J++ (now withdrawn) to C#.

False. J# is a language in its own right (neither Java now C#, though its
syntax is Java-like). Nowadays, the .NET framework comes with J# support
(it used to be an add-on) and the .NET online documentation includes J#
examples; that is, J# support is improving as time goes on.

But the important point here is your first one: J# is not Java.
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Mike said:

That depends on the definition of Java.

It is a pretty good implementation of the Java 1.1
language.

The runtime environment is not Java as it runs with .NET and not
with a JVM.
False. J# is a language in its own right (neither Java now C#, though its
syntax is Java-like). Nowadays, the .NET framework comes with J# support
(it used to be an add-on) and the .NET online documentation includes J#
examples; that is, J# support is improving as time goes on.

It is not quite obvious to me that "it is only there as a migration"
and "a language in its own right" exclude each other.

J# is a separate package in both .NET 1.1 and 2.0, 3.0 is not a full
..NET at all and 3.5 is still in beta.

Arne
 
D

David Segall

Afshin said:
Hello everybody

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started. In the past,
I used to work with Visual C++ 5.0 and 6.0 and have recently switched
to Visual Studio 2005. I see there is a Visual J# available out there.
Is it the right place to start?

Many thanks for any comments.

Afshin
 
D

David Segall

Afshin said:
Hello everybody

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started. In the past,
I used to work with Visual C++ 5.0 and 6.0 and have recently switched
to Visual Studio 2005. I see there is a Visual J# available out there.
Is it the right place to start?
If you are looking for a Java IDE then you may find my list of Java
IDEs at <http://ide.profectus.com.au> that are comparable to Visual
Studio useful.

The early versions of the standard Java text books seemed to me to be
aimed at programmers changing from C++ to Java. If you can find one
you may find it ideal. I found the constant comparison with a language
that I did not know intensely irritating so I may have exaggerated its
significance.
 
M

Manivannan Palanichamy

If you are looking for a Java IDE then you may find my list of Java
IDEs at <http://ide.profectus.com.au> that are comparable to Visual
Studio useful.

The early versions of the standard Java text books seemed to me to be
aimed at programmers changing from C++ to Java. If you can find one
you may find it ideal. I found the constant comparison with a language
that I did not know intensely irritating so I may have exaggerated its
significance.

When I was a kid, I missed to read 'The Java(TM) Programming Language'
- by James Gosling & Ken Arnold.
I will recommend you not to do the same mistake! :)
 
R

Roedy Green

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started.

C++ knowledge gets in the way. So many things in Java LOOK like
familiar C++ constructs but work quite differently.

Be warned Java Strings and arrays bear almost no resemblance to the
C++ equivalents.

You might read the Gotchas, which I wrote to myself as Java surprised
me by not behaving like C++.

see http://mindprod.com/jgloss/gotchas.html
 
L

Lew

Roedy said:
C++ knowledge gets in the way. So many things in Java LOOK like
familiar C++ constructs but work quite differently.

Be warned Java Strings and arrays bear almost no resemblance to the
C++ equivalents.

You might read the Gotchas, which I wrote to myself as Java surprised
me by not behaving like C++.

see http://mindprod.com/jgloss/gotchas.html

Great link.

Reference semantics differ also.
 
P

Patricia Shanahan

Ian Wilson wrote:
....
Converting from language A to B is usually hindered by the fact that
paradigms in A cannot be directly translated to B, You have to unleard
A's paradigms first and then learn B's paradigms.
Interfaces not Multiple Inheritance.
References not pointer arithmetic.
....

I think this effect may be why I've always been disappointed when I've
used a "conversion" book that tries to teach language B in terms of
language A.

I do better with a book that just teaches the language I want to learn.

Patricia
 
D

David Segall

Arne Vajhøj said:
There are still a free version of JBuilder - it is just called
Turbo JBuilder for 2007.
Thanks Arne. I have updated my web page accordingly. I will add some
more information when Codegear include the product in their feature
matrix.
 
C

Chris.z

Find some books like "Thinking in java" to start 'cuz you do familiar
with c++, what I suggest is that try to use notepad or EditPlus to
write your code on at the first place, Then use IDE such as Eclipse or
NetBean or JBuilder. Enjoy your java studying...
 
L

Lew

Chris.z said:
Find some books like "Thinking in java" to start 'cuz you do familiar
with c++, what I suggest is that try to use notepad
Ewww!

or EditPlus

or emacs
to write your code on at the first place, Then use IDE such as Eclipse or
NetBean or JBuilder. Enjoy your java studying...

Oh, go ahead and start with an IDE. You can use it as a "plain" editor that
shows you your syntax mistakes before you compile them.

There's no benefit that I can see at all to starting with a plainer editor;
certainly not Notepad.
 
R

Roedy Green

I have some years of experience with C++ and now need to learn java. I
appreciate if you could advise me on how to get started. In the past,
I used to work with Visual C++ 5.0 and 6.0 and have recently switched
to Visual Studio 2005. I see there is a Visual J# available out there.
Is it the right place to start?

If you have some assembler experience, you might have a peek at the
how JVM byte code works.

The big problem I had was my assembler/C background and assuming that
under the covers Java worked the same way. It is very different and
that difference is not documented BECAUSE the JVM layer gives immense
leeway to the implementor. There is almost nothing you can say for
sure about how Java HAS to work under the covers, just how it DOES
work in some particular implementations.

Crucial facts:

1. You can't use pointers/references to peer into the middle of
objects or arrays or primitives. They always point to the beginning
of objects (which includes arrays and rows in matrices.)

2. objects are not embedded inside other objects. Instead you have a
pointer to a separately allocated embedded object.

3. Java does automatic garbage collection. see
http://mindprod.com/jgloss/gc.html

4. Matrices are stored as separately allocated rows, not contiguously.
The first subscript indexes a array of pointers. Rows need not all
have the same length. see
http://mindprod.com/jgloss/gotchas.html#MATRIX

5. arrays are nearly always full. Partly full arrays or ones that
grow are stored as ArrayLists. see
http://mindprod.com/jgloss/arraylist.html

6. You can never view the same bytes in two different ways using
casts.

7. It is impossible to write a program to determine if you are running
a little or big endian CPU. You can't index into the middle of an
integer. see http://mindprod.com/jgloss/endian.html

8. Initialising is a multi step process. See
http://mindprod.com/jgloss/gotchas.html#ARRAY
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top