Click here to Skip to main content
15,867,141 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: C# and Java Pin
Nick Polyak2-Sep-22 5:41
mvaNick Polyak2-Sep-22 5:41 
GeneralRe: C# and Java Pin
Richard MacCutchan2-Sep-22 6:13
mveRichard MacCutchan2-Sep-22 6:13 
GeneralRe: C# and Java Pin
Gerry Schmitz2-Sep-22 7:02
mveGerry Schmitz2-Sep-22 7:02 
GeneralRe: C# and Java Pin
David H Walker5-Sep-22 7:12
professionalDavid H Walker5-Sep-22 7:12 
GeneralRe: C# and Java Pin
Dan Neely2-Sep-22 7:33
Dan Neely2-Sep-22 7:33 
GeneralRe: C# and Java Pin
obermd2-Sep-22 11:21
obermd2-Sep-22 11:21 
GeneralRe: C# and Java Pin
Dan Neely2-Sep-22 11:50
Dan Neely2-Sep-22 11:50 
GeneralRe: C# and Java Pin
harold aptroot3-Sep-22 1:47
harold aptroot3-Sep-22 1:47 
Yes, relatively easy. Here are some differences to watch out for:
  • Generics are different, weaker. The syntax sometimes feels oddly backwards too, eg public <T> boolean containsAll(Collection<T> c);.
  • foreach loops don't use the foreach keyword, but that takes about 10 seconds to get used to.
  • Since there are no real delegates, Java tends to use interfaces with a run method (or equivalent). That also affects how events work. You can use anonymous classes that implement the relevant interface though, you don't have to create a thousand full classes.
  • Inner classes by default have a reference to a specific instance of their outer class. To get a "plain old inner class", it needs to be a static inner class, which is not a static class. That sounds more confusing than it is.
  • Operator overloading doesn't exist. Not even for String. Avoid == between objects (including String, but also Integer), unless you really meant to compare for reference-equality. And yes, BigInteger arithmetic is pretty painful in Java .. but also pretty efficient actually. BigIntegers in C# only recently approached how efficient they are in Java.
  • In terms of the framework, List<T> -> ArrayList<T>, and Dictionary<K, V> -> HashMap<K, V> (some tutorials may mention Hashtable, disregard them).
  • There are no unsigned integers (except char but we don't talk about that), which for the most part doesn't matter (many operations are independent of signedness, and there are special methods such as Integer.compareUnsigned to implement the operations that are dependent on signedness) except that Java's byte is signed and you will probably occasionally forget that and get some bugs due to unintended sign-extension.

GeneralRe: C# and Java Pin
John Torjo4-Sep-22 20:41
professionalJohn Torjo4-Sep-22 20:41 
GeneralRe: C# and Java Pin
Southmountain3-Sep-22 8:27
Southmountain3-Sep-22 8:27 
GeneralRe: C# and Java Pin
trønderen3-Sep-22 9:36
trønderen3-Sep-22 9:36 
GeneralRe: C# and Java Pin
Southmountain3-Sep-22 17:58
Southmountain3-Sep-22 17:58 
GeneralRe: C# and Java Pin
GerVenson4-Sep-22 20:24
professionalGerVenson4-Sep-22 20:24 
GeneralRe: C# and Java Pin
StampedePress5-Sep-22 14:57
StampedePress5-Sep-22 14:57 
GeneralRe: C# and Java Pin
GerVenson6-Sep-22 9:12
professionalGerVenson6-Sep-22 9:12 
GeneralRe: C# and Java Pin
MSBassSinger5-Sep-22 3:16
professionalMSBassSinger5-Sep-22 3:16 
GeneralRe: C# and Java Pin
Member 91670574-Sep-22 20:30
Member 91670574-Sep-22 20:30 
GeneralRe: C# and Java Pin
Paul Sanders (the other one)4-Sep-22 23:09
Paul Sanders (the other one)4-Sep-22 23:09 
GeneralRe: C# and Java Pin
maze35-Sep-22 0:12
professionalmaze35-Sep-22 0:12 
GeneralRe: C# and Java Pin
Stephen86015-Sep-22 15:16
Stephen86015-Sep-22 15:16 
GeneralReSound of the week. Pin
Maximilien2-Sep-22 4:31
Maximilien2-Sep-22 4:31 
GeneralRe: ReSound of the week. Pin
Craig Robbins2-Sep-22 6:18
Craig Robbins2-Sep-22 6:18 
GeneralRe: ReSound of the week. Pin
Sander Rossel2-Sep-22 23:35
professionalSander Rossel2-Sep-22 23:35 
GeneralRe: ReSound of the week. Pin
peterkmx3-Sep-22 9:51
professionalpeterkmx3-Sep-22 9:51 
GeneralRe: ReSound of the week. Pin
David O'Neil3-Sep-22 14:56
professionalDavid O'Neil3-Sep-22 14:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.