Learn Java for Android Development

  • Learn Java for Android Development

What to learn in Java to your  Android App Development?

If you’re new to Java, or just looking to brush up on the details, then you are in the exact place to get series of Free Android Tutorials !

Android programming is based on Java programming language. If you know a basic understanding of Java programming, then it will be fun to learn Android application development.

Lets start with basic

Java definition,

Java was originally developed by James Gosling at Sun Microsystems and released in 1995. It is derived from C and C++ .“write once, run anywhere” – meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.

Java’s Important core features are:

  • It’s easy to learn and understand
  • It’s designed to be platform-independent and secure, using virtual machines(JVM bytecode interpreted on JVM)
  • It’s object-oriented
  • Developers can learn Java quickly.

Here is an Welcome example of what some Java looks like.

public class Welcome


public static void main(String[] args)


System.out.println(“Welcome ”);



First the source code. The file does three things. 1) It declares a class called Welcome 2) It defines a method ( function) in the Welcome class called main. 3) The main() method calls System.out.println to output some text.Finally,To compile and run the program you first called javac and then java.

Learn Java for Android Development

Guidelines of Java Fundamental for Android Development,


When writing computer programs you will need to store some data for temporary use. Variable names must start with lowercase letter, contain only letters, numbers, _.

Example: the value of a boolean variable can be either true or false because any (mathematical) boolean value is true or false

Declaration : boolean b = true;


Strings are an important part of any programming language including Java. Immutable type for sequence of characters.

  • Every Java variable can be converted to String via toString(),
  • The + operation concatenates Strings with other variables,
  • Let str be a String. We can find str’s length (str.length()), substrings of str (str.substring()).

Declaration String s1 = new String(“hello”)


A literal is a “fixed” value of a variable type

  • TRUE, FALSE are boolean literals
  • ‘A’, ‘\t’, ‘\”’, and ‘\u03’ are char literals (escaped tab, quote characters, Unicode value for \pi)
  • 1, 0, 035, 0x1a are int literals (last two are octal and hexadecimal)
  • 0.5, 1.0, 1E6, 6.023E23 are double literals
  • “Welcome ”, “Hello world!” are String literals


  • Single-line: // some comment to end of line
  • Multi-line :  /* comments span multiple lines */

primitive data types

There are eight primitive datatypes supported by Java

Let’s discuss each in details:


Byte is the Smallest Integer type. It has a minimum value of -128 and a maximum value of 127. It can be useful for saving memory in large arrays, where the memory savings actually matters

Declaration : byte b =100;


Short data type is a 16-bit signed two’s complement integer It has a minimum value of -32,768 and a maximum value of 32,767. To use a short to save memory in large arrays

Decalartion : short s =123;


Most commonly used integer type is int. It is a signed 32-bit type that has a range from –2,147,483,648 to 2,147,483,647. variables of type int are commonly employed to control loops and to index arrays.

int  v = 123543;

int  calc = -9876345;


long is a signed 64-bit type.  It has a minimum value of -9,223,372,036,854,775,808 and a maximum value Use of this data type might be in banking application when large amount is to be calculated and stored.

long amountVal = 123457891;


Floating-point numbers, also known as real numbers, are used when evaluating expressions that require fractional precision. The float data type is a single-precision 32-bit IEEE 754 floating point. The type float specifies a single-precision value that uses 32 bits of storage

float intrestRate = 12.25f;


Uses 64 bits to store a value. Double precision is actually faster than single precision on some modern processors that have been optimized for high-speed mathematical calculations,such as sin( ), cos( ), and sqrt( ), return double values.

double sineVal = 12345.234d;


The char data type is a single 16-bit Unicode character. It has a minimum value of ‘\u0000’ (or 0) and a maximum value of ‘\uffff’ (or 65,535 inclusive). There are no negative chars

char  ch2 = ‘Y’;.

Upcoming topics – Java Object oriented Programming Language