الخميس، 21 سبتمبر 2017

Java API ArrayList Example

Java API ArrayList Overview

In this tutorial, We'll learn about Java Collection API ArrayList.
ArrayList is a class which is widely used in real time applications. It is in package java.util and public class. This is added in java 1.2 version.

Java API ArrayList Example


Class Name: ArrayList
First Version: 1.2
Super Class: AbstractList
Implemented interfaces: List, RandomAccess, Cloneable, Serializable
Pacakge: java.util.

السبت، 9 سبتمبر 2017

Java Enhanced For loop, Examples

Enhanced for loop in java, Java enhanced for loop, Java for-each loop, Enhanced for loop example, Advantageous of for-each loop. Iterating through basic for loop. Iterating through Arrays, Iterating through Collection

Enhanced for loop to overcome the drawbacks of basic for loop and this best suitable for iterating Arrays and Collections.

Syntax:


for ( varaible_declaration : Array or Collection)
{
    //
}

Java Enhanced For loop, Examples

Java Continue Statement, Label loop

Java Continue Statement, Continue Statement in Java, Continue Examples in java, Java continue in inner loop, inner loop continue example, Continue Statement Examples.

Continue statement is used to skip the current loop iteration when a condition is satisfied.
Mainly used in while or for loop.

Syntax:

continue;

Example Flow chart:

Java Continue Statement, Label loop

الثلاثاء، 5 سبتمبر 2017

الأحد، 27 أغسطس 2017

Introduction to Java Collection over Arrays

Arrays Vs Collections

 An array is an indexed collection of fixed number of homogeneous data elements.
 The main advantageous of array is we can represent multiple values by using single variable. So
 that readability of the code will be improved.

29. Collection over Arrays


الاثنين، 13 أبريل 2015

Abstraction, Abstract class, methods in Java example

Abstract class in Java:

Abstraction defines the ability to make a class as "abstract" declaring with keyword "abstract" which is considered as incomplete.

A class which is declared with the abstract keyword is known as an abstract class in Java. It can have abstract and non-abstract methods (method with the body).

abstract keyword is used to create a abstract class and method. Abstract class in java can't be instantiated. An abstract class is mostly used to provide a base for subclasses to extend and implement the abstract methods and override or use the implemented methods in abstract class


abstract_class


Rules or Conditions of Abstract Class in Java:


1) Once we declare a class "abstract" than object can not created or instantiated for the abstract class. if we try, this will give compile time error.
2) Abstract class can have fields(properties), abstract methods.
3) This can have non-abstract methods.
4) If we declare a method as abstract than no need to provide method body. Whoever is extending this class, they have to provide implementation for the abstract methods.
5) This does not have much importance unless it has sub classes.
6) Abstract methods should be public or protected.

What is Java and why need to choose it, installed..JDK, JRE

What is Java and why need to choose:

Java is a programming language to develop the standalone application, web based, enterprise applications. Every Java developer needs obviously to be installed in their system for their needs.

As well, who does not develop Java applications and hate Java also need to install at least JRE because some of the software's are developed in Java. So to execute or run applications Java runtime environment is required.

Java is free to download and free license. Java available in 30+ languages.

When we download JDK and install it. Than we get development tools and JRE. JRE means Java Runtime Environment which consists of Java Virtual Machine(JVM), core classes along with the required core libraries. We can understand that JRE is a part of Java installation. Or individually we can install only JRE. Java plugin is required to run web browser.