Im a newbie to the world of programming and have only been learning Java for 3 months. Im finding it hard and beginning to question will it ever make sense and could I make a career out of it My goals were to pass the SCJP exam/get a job/make phone apps. One day I was looking up iphone development just to see what i could be doing with Java in the future. To my horror I realised Java had nothing to do with iphone development it was objective C . I did more research and people are saying obj c is a harder lanuage to learn. Im struggling with Java so learning oblective c would be mission impossible. To make a long story short is there any way to convert java code to objective c?
I'm not aware of any code converter, I don't like to take this route personally any way.
Don't try to learn two languages concurrently, switching the context between the two of them is going to damage your learning process.
The good news is there are a lot of similarity between Java and Objective-C, yes that including automatic memory management.
If you want to learn Objective-C and iOS development at the same time, then have a look at this book: Objective-C Fundamentals.
The mission isn't impossible, it is doable
Hussein Baghdadi wrote:The good news is there are a lot of similarity between Java and Objective-C, yes that including automatic memory management.
Well, there is a certain commonality of all modern languages, so there are similarities, but I would not call it "a lot". I do agree that once you know two or three languages, adding the next one is nearly trivial.
While Objective-C does have automatic memory management when running on OS-X, it does *not* have it on IOS. That feature is missing from the embedded operating system.
Proper IOS applications must be designed as IOS applications, with the toolset and frameworks that IOS provides. Even if there were a conversion tool, the resulting code would not look and feel like a proper IOS application.
If your must learn to write Objective-C on IOS as your very first programming environment, I wish you the best of luck. I'd start with something a bit less challenging, but that is just IMHO.
The job of Memory management belongs somewhere automated. Its good that IOS 5 has finally supported this. Too bad it will take years before we can rely upon it, as there are literally millions of devices that will never run IOS 5
Lots of old iPhones were left off the upgrade path. I don't remember the details of which, and when. This is not just an Apple thing, nearly all vendors have minimum hardware requirements for upgrades. Just as modern HTML 5 code can't run on ancient versions of Microsoft IE.
Joined: Nov 25, 2011
Thanks to all who replied. Ill keep slogging away with the Java
I would agree with Husseini of not trying to learn two things. I can not appreciate the similarity between Objective-C and Java, but if there are any, I think they may have to do with syntax. I think C is always known to sit closely with the hardware while, Java relies mostly on the JVM. Coming to iPhone/Apple, somewhere Steve had repeated Alan Kay's quote,
"People who are really serious about software should make their own hardware."
Some time ago, I wrote this article on starting with ObjectiveC development as an Android/Java developer.
Basically, it is not possible to convert Java code automatically, but as a Java developer, it is quite easy for me to map an Android app to an objectiveC equivalent.
Android code can pretty much be literally translated line per line to ObjectiveC(not taking into account the infrastructural differences, of an Activity vs a ViewController for example), without a lot of rethinking/refactoring.
And ARC is compatible with iOS 4.0 on, making it viable for most projects, since most iOS apps target only from 4.0 anyway.
There are some situations in which you cannot use it yet though, like when using third party libs that do not have conversions yet.
subject: Is it possible to convert java code to objective c?