Advertisement

Learn Java or C#

Started by October 20, 2015 10:04 PM
18 comments, last by Serapth 9 years, 1 month ago

Excuse me I just saw that I turned it around by accident.

I want to start learning Java. After that I will learn C#.

What is a good book for to learn Java programming for someone

that knows the basics of programming (in C++). With this I mean

a book that for example doesn't spend a huge amount of pages on the theory behind variables.

Thanks.

Variables (and data) are THE big differences between C++, and Java, for non-primitive types at least.

If you know C++, a book a bout Java is probably not worth buying.
Java is an order of magnitude simpler than C++.

You can use the official documentation https://docs.oracle.com/javase/tutorial/ which I found quite nice. Don't read everything, read the table of contents and https://docs.oracle.com/javase , and just look things up when needed (Java library is HUGE).
Some highlights you may want to study at first.

- Variables of non-primitive types (ie classes and Boolean, Integer, Double, and a few other boxes), in particular the fact that everything is a reference.
- arrays (not used often, but useful)
- Standard containers (list, set, map), and String.
- IO library (you generally need to create 3-5 objects to open a file). "io" is old, there is also "nio" (new io). I still fail to remember any of this stuff.
- Interfaces
- Generics, which are a bit like templates, but not really.
Advertisement

Well despite what everyone says it really does not matter. I started out with C# and learned myself a bit of XNA a couple of years ago. But then Microsoft gave up on the project and I went looking for a nice open source framework. I found LibGDX but I was hesitant at first since that required me to learn Java and a new IDE. But I went for it and I picked up Java very easy. It is basically the same and for each issue I had I could google that in seconds. Like in C# you create an multi dimensional array like int[,] myArray = new int[5,5]; and in Java it is int[][] myArray = new int[5][5];. I worked a lot with dictionaries in C# and I found out I could use a HashMap<K,V> for this in a single google search. And if there is no real equivalent to something in either language there is a library for it.

So the languages are very much alike and if you know how to program in one you know how to program in both. C++ is much different, if you know how to program in C++ then C# or Java will be easy to pickup. But not the other way around. I asked myself a long time ago if I would ever need to learn C++ and my answer was no and it still is although I was a bit disappointing I never got into C++ when UE4 came on the market for "free". That engine is amazing but there might even be C# or Java wrappers for it by now.

The thing about programming is learning how to program properly and efficient. I have been programming for many years now, I can create games and very cool stuff. But I still see myself as a beginner since there is just a ton to learn. And when you learn it you need to learn to implement it correctly in the right places with the right patterns.

First, thanks.

Second, I do like books a bit more over other sources.

As you know where to start and where to end and because it stimulates

me a bit more to learn (dunno why :D).

I hope someone is still able to help me find a book to

learn Java programming for someone who knows the basics of programming (in C++)

Thanks

First, thanks.

Second, I do like books a bit more over other sources.

As you know where to start and where to end and because it stimulates

me a bit more to learn (dunno why biggrin.png).

I hope someone is still able to help me find a book to

learn Java programming for someone who knows the basics of programming (in C++)

Thanks

Hi, depending on the book style you prefer you have Thinking in Java 4th edition (more traditional) and Head First Java, 2nd edition (full of images and diagrams, etc) try to check both and see what style fits you best (obviously you can skip the irrelevant chapters, depending on the knowledge you have from C++).

After these I believe anyone that learned Java should also read Effective Java (2nd Edition).

Someone might suggest other books, since this is a rather subjective topics and not all have read the same books... Suggest you check the amazon reviews for the books.

Hope this helps.

Thanks for the help,

I looked up both books, but I would like to mention/ask two things:

1) Thinking in java seems a bit outdated as it covers Java 2.0 (correct me if I'm wrong) and the reviews tell me that the book isn't really

aimed at beginners, but more at a bit more experienced Java programmers.

2)Is Head First Java aimed at complete programming beginners our at people that know another language already?

I asked this while I stumped upon the book Java: A Beginners Guide, 6th edition by Herbert Schildt. (http://www.amazon.com/gp/product/0071809252?keywords=java%20a%20beginner%27s%20guide&qid=1445886744&ref_=sr_1_1&sr=8-1)

The reviews tell me that the book might be quite good: it seems like the book is aimed at people who are familiair with another

programming language already, just like me.

Does someone have experience with this book? If yes, would it be good for me?

Advertisement

Thanks for the help,

I looked up both books, but I would like to mention/ask two things:

1) Thinking in java seems a bit outdated as it covers Java 2.0 (correct me if I'm wrong) and the reviews tell me that the book isn't really

aimed at beginners, but more at a bit more experienced Java programmers.

2)Is Head First Java aimed at complete programming beginners our at people that know another language already?

I asked this while I stumped upon the book Java: A Beginners Guide, 6th edition by Herbert Schildt. (http://www.amazon.com/gp/product/0071809252?keywords=java%20a%20beginner%27s%20guide&qid=1445886744&ref_=sr_1_1&sr=8-1)

The reviews tell me that the book might be quite good: it seems like the book is aimed at people who are familiair with another

programming language already, just like me.

Does someone have experience with this book? If yes, would it be good for me?

Thinking in java (4th edition) refers to SE5 and SE6 so it is still relevant for learning, Amazon unfortunately puts reviews of older editions mixed with newer so it is important to look at the review date and the release date of the books.

In the initial post you refer that you already learned some basics form c++ and therefore I believed both books will be easy to pick up.

"(Some time ago I started learning C++ programming. I went through most of the basics

(to be clear: variables, conditional statements, loops, functions, arrays, vectors, pointers, classes,

inheritance, dynamic memory and template programming)."

Regarding the Herbert book unfortunately I have not read it so I cannot give you any justified opinion regarding the contents of the book or its quality.

Java is definitely the way you want to go if you want to build desktop applications and mobile applications.

If you ever plan on releasing a game java is better for that because almost everybody has some version of

the JVM on their machine. C# is okay when used with unity, but market is dominated by windows. One

question you must ask yourself is if your more interested in making 2D games or 3D? your choice of

language would most likely depend on the answer. If 2D you should probably choose java, just because

java has some good library's to handle rendering in 2D. If 3D choose C# because you will be able to use

unity. In the end its all up to you and your preference.

As time goes on with each new release, Java and C# are converging, to the point the languages start feeling incredibly familiar.

That said, C# is younger and as a result, learned from many of Java's mistakes. The tooling is far better as is the build system. The native class libraries are also MUCH better designed.

At the end of the day though, you learn one, you can pick the other up in a weekend. Personally I can switch back and forth between the two, but I find the experience when working in Java a great deal more annoying. Especially if Maven or Gradle get involved... grrrrrrrr.

C# is okay when used with unity, but market is dominated by windows.

Not really sure I get this comment. At this day and age, C# is available on pretty much every single platform of relevance outside of embedded systems. Once you start talking embedded systems, the language is often dictated to you anyways so that doesn't really matter all that much.

On top, C# is now basically complete open source. Plus as far as a steward for a technology goes, I'd put my faith in Microsoft a thousand fold before I would ever trust Oracle.

This topic is closed to new replies.

Advertisement