Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 558723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:09:43+00:00 2026-05-13T12:09:43+00:00

I’ve been working with C# and more generally the .Net framework for a couple

  • 0

I’ve been working with C# and more generally the .Net framework for a couple of years now. I often heard about the similarity between C# & the Java language and would like to learn more about the second one.

  • Have you got any specific advice to learn Java when coming from C# ?
  • Any common errors a C# programmer would do when starting Java ?
  • Any documentation showing the habits you can keep and the ones you must change (still in a C# to Java optic, so something a bit more specific then a C# vs Java comparison) ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:09:43+00:00Added an answer on May 13, 2026 at 12:09 pm

    Well, while C# and Java are superficially alike there are a number of small differences that might bite you. Generally I think the opposite direction—going from Java to C#—is less problematic. This is mainly due to C# being a more complex language so you might find many simplifications from common Java patterns but the other way around might be a little painful.

    Things to look out for (partial list, not guaranteed to be exhaustive):

    • Different …

      • Naming conventions. In Java only type names start with a capital letter (i. e. PascalCase), everything else uses camelCase. Not very hard to adhere to, though.

        Also interfaces generally don’t start with I. On the other hand you have to implement them with a different keyword. Doesn’t really help in the middle of the code, though.

      • Class library 🙂

        While obvious, this has been the thing I spent most time on when learning a language. When dealing with a known paradigm the syntax differences are quickly sorted out, but getting to know the standard library / class library / framework takes some time in some cases 🙂

      • Patterns. Well, not quite, it’s still the same stuff. But C# supports some patterns at the language level, while you still have to implement them yourself in Java. No events, but the Observer pattern (very prevalent in Swing—whenever you see a Listener, you know what to do :-))
      • Exception handling. Java has so-called checked exceptions which means that an exception must either be caught or declared upwards. Usually this means that you have

        catch (SomeException ex) {
          ex.printStackTrace();
        }
        

        pretty often in your code1 🙂

      • Types. While .NET has normal objects and value types, they both are objects and support methods, properties, &c. Java has a dichotomy of primitive types, such as int, float, char, &c. and classes such as String. Doesn’t matter much since they implemented auto-boxing, but sometimes it’s still annoying to wrap int in Integer.
      • Polymorphism: All Java methods are virtual by default whereas c# methods are not.
    • Minor syntactic differences.
      • foreach (a in b) → for (a : b)
      • Different access keywords. Things like internal and protected internal don’t exist. But unqualified members are visible to other classes in the same package (sort of internal, but then again not quite).
      • String comparison isn’t done with == in Java. You have to use .equals(). While in C# == on strings is value equality, in Java == is always reference equality.
    • No …

      • Properties. In Java this is generally done with the Foo getFoo()/void setFoo(Foo foo) pattern which C# generates silently behind your back when using properties but you have to do it explicitly in Java. Generally, to keep the language itself simpler many things in Java are just conventions. Still, most of the time you’re better off adhering to them 🙂
      • Operator overloading. Deemed a hazard to the righteous programmer they weren’t implemented for fear of abuse. Don’t need them too often anyway, not even in C#, but sometimes they are nice and then you’re missing something.
      • Indexers. You always have to access list items through myList.get(5) instead of the array-like syntax myList[5]. Just a mild inconvenience, though.
      • LINQ (though there exist implementations2 but it’s not as nicely integrated), or lambda functions3 (no delegates anyway, but anonymous classes), extension methods, or partial classes (yes, that’s a painful one when dealing with Swing, unless you’re very disciplined), and a few more things.
      • Multidimensional arrays. You can use jagged arrays (arrays of arrays), buttrue multidimensionality isn’t there.
    • Generics are compile-time only, at runtime only Objects remain. Also wildcards in generics can be hard to resolve sometimes when the compiler complains about all of the four ? in your generics having different types. (Though to be fair: That was a case where I would have needed type information at runtime anyway so I reverted back to Objects).

    General advice: Grab a friend with Java experience and let him glance over your code. While he probably can’t tell you everything you should take care of when you directly ask him that question, he can spot strange things in code just fine and notify you of that. This has greatly helped me learning Java (although I learned Java first and then C#, so it might be different).


    1 Yes, I know many catch blocks look different, but still, this is probably the archetypical one and not even that rare.
    2 Quaere, JaQue, JaQu, Querydsl
    3 There’s lambdaj, though. Thanks for pointing that out, Esko.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.