26

Should I learn Java before learning Android or I can do both things in parallel? What is the best approach?

4
  • If you go into your old questions, you can "tick" the answer which is most helpful. Some people get disgruntled at those who don't bother doing so. Personally I don't find it anything to get worked up about, but there we go...
    – Jon Skeet
    Commented Aug 16, 2010 at 18:58
  • 3
    Similar questions: stackoverflow.com/questions/2981495/… and stackoverflow.com/questions/2915410/…
    – Jesper
    Commented Aug 16, 2010 at 19:01
  • if you're asking whether you can learn android and java in parallel then definitely not , if you're asking whether java is mandatory well while java is kind of lingua-franca for android, you can definitely use some other languages like C#(Xamarin) and C++(Qt)
    – niceman
    Commented Jul 30, 2015 at 18:38
  • Java is an object oriented language. So if you learn OOP, you'll quickly grasp java: Take the "Master Object Oriented Design" course on eliminatecodefear.com - One of the best resources for learning practical object oriented design and development with HW assignments Commented Feb 8, 2016 at 4:30

6 Answers 6

75

I would absolutely learn Java first. Don't bother learning things like servlets, Swing etc - but learn:

  • The core language
  • Collections
  • IO
  • String handling

Trying to learn these while also learning a completely new environment will make it a lot harder to work out where you're going wrong.

Note that this isn't specific to Android - I'd always encourage developers to learn the "core" of a new platform before learning "peripheral" technologies such as native UIs or web frameworks.

I've seen people try to do this before - literally asking complicated questions about advanced scenarios, while not understanding the basics of the language. Sometimes the problem they've been having has been due to the complex API they were using, and sometimes it's been due to the basic misunderstandings - but the problems looks exactly the same to them. They can't tell the difference between not understanding how method arguments are passed, and having difficulty with cross-threading UI operations. As far as they're concerned, "something has gone wrong." Every step is painful when you don't have a solid foundation.

Aside from anything, as boring as console applications with no interaction might be, they're really great for just testing something quickly. You typically don't need to worry about threading, permissions, graphics, resources etc. Another good way to test your understand is via unit tests. Rather than a normal test-first approach, write a method and predict its output with unit tests, until you run out of interesting situations to test. Once you're done, you've got a complete record of what the code does - keep it for later on, in case you need to revisit the concept you were testing.

5
  • 2
    Agreed - I am a developer who has already done a lot of programming in C# and Java. It wasn't hard to get in and make code behind work for the first Android app I'm doing. So most of my learning is now going to be UI interaction and phone specific stuff. But without the Java knowledge, I'd be lost.
    – theJerm
    Commented Oct 5, 2012 at 22:28
  • @JonSkeet and what if I am an expert C# developer, can I dive into android development?
    – Alex
    Commented Mar 11, 2013 at 9:17
  • @AliIssa: I would still take a little time to experiment with desktop Java first, just to find your feet. Spend a week exploring the language and core APIs that way, then start Android.
    – Jon Skeet
    Commented Mar 11, 2013 at 9:29
  • Hi, I have a question, how would you define the core language?
    – SanketDG
    Commented Jun 29, 2015 at 14:41
  • 1
    @SanketDasgupta: Classes, interfaces, fields, methods, constructors, generics... the kinds of things defined in the language specification as opposed to in some API.
    – Jon Skeet
    Commented Jun 29, 2015 at 14:53
9

Learning is always easier when you have a goals to work towards. If your goal is to do primarily Android programming, focus on that and you'll pick up Java on the way.

6
  • 16
    And for your next act, you might want to write a book in Chinese. Don't bother learning anything about it first - I'm sure you'll pick it up along the way. Seriously, it's going to be much easier to learn Java in an environment which makes it easy to play with, write console apps in etc. When the OP runs into a problem while writing an Android app, it's going to be really hard to diagnose what's going on if he doesn't know the language beforehand.
    – Jon Skeet
    Commented Aug 16, 2010 at 18:58
  • 3
    I thinking comparing learning a specific use of a programming language to writing a book on a spoken langauge is a bit harsh. Last time I checked Android uses Java, so I found it pretty obvious that my meaning was to learn Java and Android at the same time, rather than focus 100% on Java, then turn to Android.
    – Robert
    Commented Aug 16, 2010 at 19:07
  • @Robert: But learning to platform on a mobile environment (or indeed learning pretty much any advanced client UI technology) when you don't know the language is much trickier than learning the core of the language in a simpler environment and then moving on to the harder version of the platform. I would strongly advise against trying to learn two significant things at the same time.
    – Jon Skeet
    Commented Aug 16, 2010 at 19:12
  • Again I wasn't expecting him to dive into Android programming with no knowledge of Java at all, I simply meant that he shouldn't focus on Java and neglect Android. Just my personal opinion and experience in the past as I pick up a language/platform much more quickly with a project to work towards. He did not mention if he had any previous programming experience or not so I based it off my opinion.
    – Robert
    Commented Aug 16, 2010 at 19:27
  • 3
    I am unsure of the intent of your comments, is it to provide the OP with valuable information or to attempt to bash me? If the latter, my position remains that my learning style would be to take up both at the same time as I would be curious as to how I would use the Java in tandem with Android. As such, depending on his prior programming knowledge, this approach may work for him as well.
    – Robert
    Commented Aug 16, 2010 at 19:54
3

Yes I would learn at least the basics of Java prior to starting on Android.

Starting in Android would be like learning to scuba dive before learning to swim, sure you could probably struggle your way along, but you'll be making the process unnecessarily more difficult for yourself.

2

The tutorial given in the Android Developer Website is hard to understand if you don't know anything about java. I'd recommend starting with Java basics and then go on with Android. It would be the best way to understand everthing in an easier way.

In Java, you'll also have to focus the way to do things efficiently because mobile battery is a matter to take into account in mobile applications.

1

if you know c# ,you can start android now

1
  • Not really true. You can start Xamarin nowadays Commented Oct 30, 2017 at 4:35
1

Java first if you know C# its close enough where you can do it the way you wanted. otherwise, definatly java.

Learn to open a file, deal with user input especially strings, learn all the basic keywords

if your new to dev in general, learn looping, branching, embedding decision making. "your a long way from android in this case i would say" a good book will help a lot more then the free crap youll find online. i went the online route for months and stuggled. grabbed a good book and was moved on the android in 2weeks. if you know where to look, good books are also free ;)

Not the answer you're looking for? Browse other questions tagged or ask your own question.