[18 Jan 2012 | No Comment | 340 views]

Array elements in Java can have only one declared type (int[], char[], Person[], Animal[]) and it need not necessarily mean that it can hold elements only of that type.

Java Primitive array elements

If an array is declared as any Read more…

[18 Jan 2012 | No Comment | 460 views]

This is the third method for declaring, creating and initializing an array object in one line.

One Dimensional Array

or,

When you use this method size should not be specified.
Person[] arr = new Person[2] {p1, p2}; //ERROR

This method Read more…

[18 Jan 2012 | No Comment | 637 views]

This is the second method for declaring, creating and initializing an array object in one line.

Primitive

How this works?

  • Declares a double array reference variable named studentAvgs;
  • Creates a double array object in the memory with a length of

Read more…

[17 Jan 2012 | No Comment | 647 views]

One Dimensional Array

Initializing an array means assigning values to the array elements. It can be either primitive values (12, 75.5, true, etc) or object reference (Animal, Person, String, etc)

null
Exception in thread “main” java.lang.NullPointerException
at com.ibytecode.arrays.TwoDReferenceArray.main(TwoDReferenceArray.java:17)

  • Individual elements

Read more…

[17 Jan 2012 | No Comment | 431 views]

All array objects have one built-in public variable to determine the length of an array.

Syntax:

arrayName.length

Read more…

[17 Jan 2012 | No Comment | 772 views]
  • This step creates an actual array object on the heap memory with the specified size i.e.) number of elements this array will hold.
  • Size must be a positive integer value.
  • This is done using new keyword/operator.
  • This step is also

Read more…

[17 Jan 2012 | No Comment | 705 views]

Syntax: One Dimensional Array

Method 1Type[] arrayReferenceName; //Recommended
Method 2Type arrayReferenceName[]; //Legal, but not recommended

Syntax: Two Dimensional Array

Method 1Type[] [] arrayReferenceName; //Recommended
Method 2Type arrayReferenceName[] []; //Legal, but not recommended

Type can be either Read more…

[17 Jan 2012 | No Comment | 7,178 views]

To create a database in MySQL, you use the CREATE DATABASE statement as follows:

CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification] …

create_specification:
[DEFAULT] CHARACTER SET [=] charset_name
| [DEFAULT] COLLATE [=] collation_name

CREATE DATABASE statement will create Read more…

[17 Jan 2012 | No Comment | 923 views]

Why arrays?

Suppose we have a requirement to store average mark scored by each student. To accomplish this we define different variables (identifiers) of type double to store each student’s average mark.

As you can see, it seems like a Read more…

[17 Jan 2012 | No Comment | 1,624 views]

1. Relational Database Management System (RDBMS)

  • Software application that control the creation, maintenance, and use of a database.
  • Based on the relational model.
  • Data is stored in tables and the relationships among the data are also stored in tables.
  • The

Read more…