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:

Eclipse:

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
Variables Learn about variables and how they are created for storing information in memory
Data Types Learn about Data Types (i.e. byte, int, char etc) which is basically a type of information we want to store in variable.
String String is nothing but a character array for example “AbhiAndroid” is a string of 11 characters as shown.
Operators In computer programming Operator is a symbol that tells the compiler to perform specific action which can be mathematical or logical.
Keywords Keywords 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 Objects The 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.
Method A method is a self contained block of code that performs a specific task.
If Then Else If then allow us to control the flow of program based on conditions, whether to execute a code or not.
For Loop In JAVA For statement is the most commonly used lopping statement which iterate over a range of numbers.
While Do While The 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.
Arrays Array 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.
Inheritance It is a mechanism that allows the class to use the states and behavior of another class.
Abstraction It is a process of hiding internal working and showing only necessary details.
Method Overriding Method Overriding means to re-write the previous described method again of Parent Class in Sub class with different functionality.
Method Overloading It allows multiple methods to have same name if the parameter list inside parenthesis are different.
Interface It is able to achieve 100% abstraction as it only contains those methods which has no implementation (i.e. methods without body).
Encapsulation Wrapping up of data member and member functions together into a single unit (i.e. Class) is called Encapsulation.
Polymorphism It means one name and many duties. Polymorphism refers to the ability of one thing to take many(Poly) distinct forms(Morphism).
Constructor A constructor is a special method that is called whenever an object is created using the new keyword.
Access Modifier Java provides us a many number of access modifiers to set access levels for class, variables, methods and constructor.
Composition Composition 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.
List It is the sequence of elements, or we can say collection of elements, on which user has precise control over where an elements are inserted.
ArrayList It is a dynamic data structure in which you can add or remove any number of elements and those elements are stored in ordered sequence.
LinkedList It 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.
Vector It 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.
Map It 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.
HashMap It 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.
LinkedHashMap In 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.
TreeMap It 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.
Set It is the group of elements, or we can say collection of elements, that can never contains Duplicate element.
HashSet It is a type of Java Collection that implements the Set Interface and extends AbstractSet Interface. It uses Hash table for storing the data.
LinkedHashSet It 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.
TreeSet In 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.
Iterator Java Iterator is an Interface that belongs to the collection framework allow us to traverse the collection objects and access the elements of  that collection.
ListIterator Special type of Iterator that is only for List Interface is known as ListIterator