JAVA For Android – Tutorial, Examples And Programs

Android App are mostly developed in JAVA language using Android SDK (Software Development Kit). Other languages like C, C++, Scala etc. can also be used for developing Android App, but JAVA is most preferred and mostly used programming language for Android App Development. So if you are a beginner in Android then JAVA language and complete knowleadge of OOPS concepts is the first thing you need to learn before beginning Android Development.

Introduction To JAVA

JAVA is a programming language which is used in Android App Development. It is class based and object oriented programming whose syntax is influenced by C++. The primary goals of JAVA is to be simple, object-oriented, robust, secure and high level.

JAVA application runs on JVM (JAVA Virtual Machine) but Android has it’s own virtual machine called Dalvik Virtual Machine (DVM) optimized for mobile devices.

Prerequisites For JAVA:


Being a JAVA programmer you will need some tools or software to code and run it. Lots of tools are available over the web but we recommend you to use Eclipse for learning JAVA since it is the most common tool used for Android Development alongwith Android Studio. So getting habitual with Eclipse and its shortcuts will be bonus in your Android journey. Other then Eclipse you can also prefer IntelliJ or netbeans for learning JAVA.

Other Tools: IntelliJ and Netbeans

Android Studio? Are you thinking of using Android Studio for learning JAVA? Then Android Studio is solely meant for Android programming. IntelliJ, Eclipse and Netbeans are for real Java codings.

Tutorial On JAVA Topics For Android:

Below are the tutorials on JAVA:

JAVA For Android Tutorial
Topics (Follow the link to read tutorial)Description
VariablesLearn about variables and how they are created for storing information in memory
Data TypesLearn about Data Types (i.e. byte, int, char etc) which is basically a type of information we want to store in variable.
StringString is nothing but a character array for example “AbhiAndroid” is a string of 11 characters as shown.
OperatorsIn computer programming Operator is a symbol that tells the compiler to perform specific action which can be mathematical or logical.
KeywordsKeywords in JAVA are predefined list of keywords which has a specific meaning and cannot be used in the Java programming language as an identifier, such as the name of a variable, method, class, function, or label.
Class And ObjectsThe concept of class comes into role when we see certain type of objects or things around us and the common idea or a blueprint behind this type of objects is called Class. Object is an instance of class.
MethodA method is a self contained block of code that performs a specific task.
If Then ElseIf then allow us to control the flow of program based on conditions, whether to execute a code or not.
For LoopIn JAVA For statement is the most commonly used lopping statement which iterate over a range of numbers.
While Do WhileThe While is a type of loop which evaluate the condition first. If condition evaluate to true the code inside the block{} will be executed and if it evaluate to false it will jump outside the while loop.
ArraysArray can be defined as a contiguous memory locations used to store the homogeneous data types. In simple words, it is a variable that can store multiple values of single data type.
InheritanceIt is a mechanism that allows the class to use the states and behavior of another class.
AbstractionIt is a process of hiding internal working and showing only necessary details.
Method OverridingMethod Overriding means to re-write the previous described method again of Parent Class in Sub class with different functionality.
Method OverloadingIt allows multiple methods to have same name if the parameter list inside parenthesis are different.
InterfaceIt is able to achieve 100% abstraction as it only contains those methods which has no implementation (i.e. methods without body).
EncapsulationWrapping up of data member and member functions together into a single unit (i.e. Class) is called Encapsulation.
PolymorphismIt means one name and many duties. Polymorphism refers to the ability of one thing to take many(Poly) distinct forms(Morphism).
ConstructorA constructor is a special method that is called whenever an object is created using the new keyword.
Access ModifierJava provides us a many number of access modifiers to set access levels for class, variables, methods and constructor.
CompositionComposition is a special case of aggregation. In other words, a restricted aggregation is called composition. When an object contains the other object and the contained object cannot exist without the other object, then it is called composition.
ListIt is the sequence of elements, or we can say collection of elements, on which user has precise control over where an elements are inserted.
ArrayListIt is a dynamic data structure in which you can add or remove any number of elements and those elements are stored in ordered sequence.
LinkedListIt stores data in the forms of nodes, which is divided into two parts, first part stores the data and second part points to the next node by storing the address of that node.
VectorIt is type of data structure that implements List Interface. It is very much similar to ArrayList as it also maintains insertion order, that is elements are retrieved in same order as they are added into it.
MapIt is the mapping between a key and a value i.e. it contains values based on the key. Each key value pair is often known as an entry, As Map contains only unique keys, we can also say Map interface maps unique keys to its corresponding values.
HashMapIt is a type of Collection, that stores our data in a pair such that each element has a key associated with it. The pair of key and value is often known as Entry and these entries can have only unique keys.
LinkedHashMapIn Addition to all the functionalities of HashMap Class, the functionality of maintaining the insertion is added into LinkedHashMap and to attain this  functionality all the entries(key and value) are linked to each other using doubly-linked list.
TreeMapIt can  stores only unique elements, that is duplicate values are not allowed and it cannot store key as null but is can  store null values. It is mostly similar to HashMap and key difference is it maintains an increasing order according to the key value.
SetIt is the group of elements, or we can say collection of elements, that can never contains Duplicate element.
HashSetIt is a type of Java Collection that implements the Set Interface and extends AbstractSet Interface. It uses Hash table for storing the data.
LinkedHashSetIt is a type of Collection, which takes all the functionalities of HashSet class, that it does not allow duplicate elements to be stored and allow null elements in it.
TreeSetIn TreeSet all the values are stored in there natural order, like all integer values are stored in ascending order and strings are stored according to Dictionary values. Apart from adding this functionality of maintaining natural ordering, Tree Set do not allow null values.
IteratorJava Iterator is an Interface that belongs to the collection framework allow us to traverse the collection objects and access the elements of  that collection.
ListIteratorSpecial type of Iterator that is only for List Interface is known as ListIterator