[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-05-05
16
Medium Priority
?
232 Views
Last Modified: 2010-03-31
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
0
Comment
Question by:Alexandre Simões
  • 5
  • 4
  • 2
  • +4
15 Comments
 
LVL 13

Expert Comment

by:kawas
ID: 16619447
www.eclipse.org is a great free ide

c# is very similar to java (microsoft took java and renamed it ;-)
0
 
LVL 92

Assisted Solution

by:objects
objects earned 400 total points
ID: 16619481
a good general tutorial to get you started

http://java.sun.com/docs/books/tutorial/index.html
0
 
LVL 13

Expert Comment

by:Kelvin_King
ID: 16619489
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 23

Assisted Solution

by:Siva Prasanna Kumar
Siva Prasanna Kumar earned 200 total points
ID: 16619645
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 16622116
Compile C# code in Java. If there are any compilation errors, remove them. And it will work ;-)
0
 
LVL 4

Assisted Solution

by:fffej78
fffej78 earned 600 total points
ID: 16698347
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
 
LVL 30

Author Comment

by:Alexandre Simões
ID: 16698750
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
 
LVL 4

Expert Comment

by:fffej78
ID: 16699000
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
 
LVL 30

Author Comment

by:Alexandre Simões
ID: 16702619
:) 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
 
LVL 30

Expert Comment

by:Mayank S
ID: 16706306
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
 
LVL 30

Author Comment

by:Alexandre Simões
ID: 16707129
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 16707156
>> misused can conduct to a namespaces maze

Yes, that is true. Having it in a hierarchical manner by default helps.
0
 
LVL 30

Author Comment

by:Alexandre Simões
ID: 16713874
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
 
LVL 30

Accepted Solution

by:
Mayank S earned 800 total points
ID: 16716216
>> 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
 
LVL 30

Author Comment

by:Alexandre Simões
ID: 16897734
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question