JAVA for a .net C# developer... Help!

Hi...

I need something that goest on the oposite direction of the flow.
I'm a .net developer for 4 years and now I need to leand some JAVA.

I find a lot of books helping people on the migration process from JAVA to C# but found none about the other way around.

Also... what's the most used IDE for non-web JAVA apps? JBuilder?

Can anyone help me?

Thanks!
Alex :p
LVL 31
Alexandre SimõesManager / Technology SpecialistAsked:
Who is Participating?
 
Mayank SAssociate Director - Product EngineeringCommented:
>> you don't have access to the main namespace, it always begins with the project name

No, you can choose your own, though that is what the default is. Generally every organization will have its own naming standards (you can also change the assembly output-name based on that).

>> C# on the other hand is more wide when it comes to let devs really do what they want, even if it's wrong

M$ recommend using C# more than VB .NET. In fact the Visual Studio IDE was also developed using C#

>> I just got 2 books

Have you taken the online tutorial at: http://java.sun.com/docs/books/tutorial/ and samples at http://www.javaalmanac.com (links were posted above)
0
 
kawasCommented:
www.eclipse.org is a great free ide

c# is very similar to java (microsoft took java and renamed it ;-)
0
 
objectsCommented:
a good general tutorial to get you started

http://java.sun.com/docs/books/tutorial/index.html
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Kelvin_KingCommented:
There's lots of books on java to C# for the simple reason, java came out before C#. The best way to learn your java is to get a beginner book or just read the java online tutorial. Don't bother about finding a book that help you 'migrate' from C# to Java, because at the end of the day your OO concepts are already there, so it's just a matter of picking up the use of the Java API.

Have a read at the java tutorial and take it from there:

http://java.sun.com/docs/books/tutorial/information/download.html

Good luck with it!
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
http://javaalmanac.com/

http://www.java2s.com/

here are two great websites to start of java with practice with lot many examples to make your learning more practical.

Use eclipse and try out any programs which you feel like.

as you are already an experienced programmer i think you can try a book like "Think in java"which is a easy to go book.
available online.

http://www.mindview.net/Books/TIJ/

Thank You.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Compile C# code in Java. If there are any compilation errors, remove them. And it will work ;-)
0
 
fffej78Commented:
I can highly recommend the "IntelliJ" environment for developing with Java, you can download a free trial from http://www.jetbrains.com/idea/.

Java and C# are very similar languages, as has been pointed out.  Java does not support properties from C#, but both languages have very similar syntax.  I guess the equivelent of the .NET framework in Java is the vast collection of API packages included with Java.  Again the online documentation from Sun (http://java.sun.com/j2se/1.5.0/docs/api/index.html) is very helpful here (compares favourably with MSDN, which I'm sure you've used for C# development).

For developing UI's there are a number of options, Eclipse seems to favour SWT (http://www.eclipse.org/swt/), whereas Sun prefers the Swing UI components (see http://java.sun.com/docs/books/tutorial/uiswing/ for an introduction).

In terms of implementing, as many people have already said it is very similar, so you can probably just dive straight in!

There are some minor differences, I'll try to enumerate a few

boolean in Java is bool in C#

Switch statements differ.  In Java control can fall through to the next label, whereas in C# it cannot.  For example the following is legal Java, but not C#
switch ( i )
{
  case 1:
  case 2 print( "foo")
  default: print( "bar")
}

In Java this would print foo then bar for i == 1 or i == 2, whereas in C# it wouldn't compile.

With the advent of Java generics you can now use a colon in a for-loop to emulate C#'s, for-each construct.

Java has checked exceptions - for example, try to open a file and you are forced to surround it with a try/catch handler.  C# doesn't require this.

The keyword for access the superclass differ - in C# you used "base", in Java you'd use "super"

There is no operator overloading or partial classes in C#

If you've used C# 2.0's generics feature you should feel right at home with Java SE 5's generics as they are very similar in use.

Hope that helps!
0
 
Alexandre SimõesManager / Technology SpecialistAuthor Commented:
Hi fffej78...
Thanks for the comparison.

I just want to correct some wrong things about C# (talking about 2.0)

1. C# Swich always did fall into lower levels by default.
To make it get out you must add a break:

                        switch (Name)
                        {
                            case "aaa":
                                // Do something and fall to the next
                            case "bbb":
                                // Do something
                                break;
                            default:
                                break;
                        }

2. Framework 2.0 now supports Partial Classes...


Anyway, I really liked the hints!
Thanks!

Alex :p
0
 
fffej78Commented:
Sorry - good point about the switch!

And my bad - I made a cock-up :)  Java is the one that doesn't support operator overloading or partial classes!  They're that similar that making a mistake like that is easy :)

Thanks
0
 
Alexandre SimõesManager / Technology SpecialistAuthor Commented:
:) no prob...

You know, my main trouble is mapping the namespaces...
I kind'a have all the .net namespaces tree on my head and I find it dificult to map that structure to JAVA's.

For sure it's only a matter of practice... :)

Thanks!
Alex
0
 
Mayank SAssociate Director - Product EngineeringCommented:
I find packages a lot better organized in Java than the namespaces in .NET. They are easier to manage and maintain in Java because they are contained in the same folder structure. In .NET, you can give any namespace inside an assembly, give the same namespace in 2 assemblies, and this really does not guarantee easy management. If you want to look for something - you don't know where to look :)
0
 
Alexandre SimõesManager / Technology SpecialistAuthor Commented:
Hi!

mayankeagle :
As I said for me relating to JAVA namespaces, it's just a matter of practice... :)

I actually use that ability on my projects.
Usually I use a plug-in approach to add functionalities to my compiled solutions.
Sometimes I want to add classes inside namespaces that are defined on the main solution just because they belong there.

It's like everything else... misused can conduct to a namespaces maze, you just have to be consistent.

This weekend I'll put some time on this :)
Lets see how it turns out...

Alex
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> misused can conduct to a namespaces maze

Yes, that is true. Having it in a hierarchical manner by default helps.
0
 
Alexandre SimõesManager / Technology SpecialistAuthor Commented:
I don't want to stretch more this Namespaces matter, just want to add that looks like VB.net acts like JAVA.
In VB.net you don't have access to the main namespace, it always begins with the project name.
So the idea is just that.... VB.net presented as a language as powerful as any other .net managed language, it's more focused on helping developers doing more thing behind the scenes.
C# on the other hand is more wide when it comes to let devs really do what they want, even if it's wrong... eheheheh

Btw...
I just got 2 books:
The JAVA programming Language 4th Edition
The JAVA Language Specification 3rd Edition

They seemed the top notch... :)

Thanks!
Alex
0
 
Alexandre SimõesManager / Technology SpecialistAuthor Commented:
Thank you all...
I've been way over my head these days.

The link are noted tho, and I'll give them a try as soon as I can spear som time on them.

Once again,
Thanks!

Alex :p
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.