Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resources to compare Java to Objective-C (syntax and basics)

I have taught myself a lot of Objective-C over the past year and a half, and have even been able to publish some iOS apps on the App Store. Concepts that were foreign to me before about object oriented programming are now second nature and I understand MVC, inheritance, polymorphism etc. I'm now interested in learning to develop for the Android platform, which will entail learning Java. I want to find resources that can match up Java basics with regards to syntax and structure with the same things from the Objective-C world.

The Wikipedia entry for Objective-C has exactly what I'm looking for with regards to how Objective-C relates to C++. If there is a document, blog post or book dedicated to something like this for Java in relation to Objective-C I would be all over it like a bear on honey. It should include things like

  • Class method declarations and implementations
  • instance method declarations and implementations
  • How to compose a method name (ie +/-(returntype)methodName:(type)argument; )
  • declaring properties

Thank you for all of your suggestions!

like image 968
Daddy Avatar asked Dec 20 '10 21:12

Daddy


People also ask

Is Objective-C similar to Java?

Objective-C is a compiled OO programming language. Java is both compiled and interpreted and therefore does not offer the same run-time performance as Objective-C. Objective-C features efficient, transparent Distributed Objects. Java features a less efficient and less transparent Remote Machine Interface.

Should I learn Java or C++ first?

Most programmers agree that Java is easier to learn first. Java's syntax is usually easier for new programmers to understand. The syntax requirements in C++ are very strict. It is difficult to write C++ in a readable way and making a single mistake can set off a chain of errors.

Which is easy C++ or Java?

Most experts will tell you that Java is easier to learn. It's a newer language than C++ and isn't as complex in its principles or execution. However, there's more to consider than a language's learning curve. Selecting a programming language comes down to what you want to do with it.

Why is C better than Java?

Java is more data-oriented. C is a middle-level language because binding of the gaps takes place between machine level language and high-level languages. Java is a high-level language because translation of code takes place into machine language using compiler or interpreter.


1 Answers

"Matching up syntax" is not necessarily a useful thing. The two languages are not merely different syntaxes for the same thing. Lots of people go into a new language with that mindset, and it leads them to write bad code in their new language. For example, class methods in Objective-C are roughly equivalent to static methods in Java, but class methods can be overridden in subclasses while static methods can only be hidden by new static methods — they're more similar to namespaced functions than methods.

Better to just learn Java from a good book or tutorial — without your baggage from Objective-C.

like image 75
Chuck Avatar answered Sep 24 '22 08:09

Chuck