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.
If an array is declared as any Read more…
This is the third method for declaring, creating and initializing an array object in one line.
or,
When you use this method size should not be specified.
Person[] arr = new Person[2] {p1, p2}; //ERROR
This method Read more…
This is the second method for declaring, creating and initializing an array object in one line.
How this works?
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)
All array objects have one built-in public variable to determine the length of an array.
Syntax:
arrayName.length
Syntax: One Dimensional Array
Method 1 | Type[] arrayReferenceName; //Recommended |
---|---|
Method 2 | Type arrayReferenceName[]; //Legal, but not recommended |
Syntax: Two Dimensional Array
Method 1 | Type[] [] arrayReferenceName; //Recommended |
---|---|
Method 2 | Type arrayReferenceName[] []; //Legal, but not recommended |
Type can be either Read more…
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…
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…
1. Relational Database Management System (RDBMS)