Arrays in Java.

In this article,Arrays in Java is explained in detail with examples. you will come to know about what are Arrays in Java, how they are defined and how they are initialized in the Java program.
An Array is a collection of elements of same data type.
Syntax
(datatype) array name[]; //array declaration
Ex
int a[]; //no size of array should be given.
In java,while declaring an array, we don't give the size. After declaration, size is allocated to the new operator. (From topic Arrays in Java)
Syntax
arrayname=new (datatype)[size];
Ex
a=new int[5];

Examples on Arrays and ForEach Loop.

In this article,Examples on Arrays and ForEach Loop are explained in detail with examples. we will solve some examples related to the arrays and learn about Foreach Loop.
Ex
//programs related to Examples on Arrays and ForEach Loop--the sum of elements in an array.
class ArraySum
{
public static void main(String args[])
{
int a[]={11,22,33,44,55};
int i,sum=0;
for(i=0;i<5;i++)
sum=sum+a[i];

Possible Array Declarations and 2-D Arrays.

In this article,Possible Array Declarations and 2-D Arrays are explained in detail with examples.
In java we can declare an one dimensional arrays in possible ways.
int a[];
int []a;
int...a; //used only as varargs in methods
          // as last parameter.
Command line arguments
The main method takes string arrays as the input parameter.Such parameters could be passed as arguments while executing the Java program.
Syntax

Matrix addition,subtraction and Wrapper Classes.

In this article,Matrix addition,subtraction and Wrapper Classes are explained in detail with examples.
To perform these operations, the necessary and sufficient condition are both the matrices should be of same order because the operation is performed on corresponding elements from both the matrices.
Ex
//program related to Matrix addition,subtraction and Wrapper Classes-add,subtraction of a matrix.
class MatrixAddSub
{
public static void main(String args[])
{
int a[][]=new int[2][2];
int b[][]=new int[2][2];

Object Class and Constructors in Java.

In this article,Object Class and Constructors in Java are explained in detail with examples.
It is a pre-defined class in java available in "java.lang " package.
This class is a Base-class or Super-class for all our user-defined classes or pre-defined classes directly or indirectly.
This class provides runtime instance for all your classes getting executed in the memory
This class contains 7-native methods.
Native methods are those methods whose implementation is done in other languages like C and C++.
The following methods are native methods in the object class. (From topic Object Class and Constructors in Java)

Connect with Us by Subscribing here for more Updates..!

* indicates required