Thursday, December 12, 2013

Array objective methods in java



Array  of Object

The Array object is used to store multiple values in a single variable.

Array Object Properties

Property                                                              Description

Constructor        Returns the function that created the Array object's prototype
Length                  Sets or returns the number of elements in an array
prototype           Allows you to add properties and methods to an Array object

Array Object Methods

Method                                                               Description

concat()               Joins two or more arrays, and returns a copy of the joined arrays
indexOf()            Search the array for an element and returns its position
join()                     Joins all elements of an array into a string
lastIndexOf()     Search the array for an element, starting at the end, and returns its position
pop()                     Removes the last element of an array, and returns that element
push()                   Adds new elements to the end of an array, and returns the new length
reverse()             Reverses the order of the elements in an array
shift()                    Removes the first element of an array, and returns that element
slice()                    Selects a part of an array, and returns the new array
sort()                     Sorts the elements of an array
splice()                 Adds/Removes elements from an array

Boolean Object

The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).
For a tutorial about the Boolean object, read our JavaScript Boolean Object tutorial.

Boolean Object Properties

Property                                                              Description
constructor         Returns the function that created the Boolean object's prototype
prototype           Allows you to add properties and methods to a Boolean object

Boolean Object Methods

Method                                                               Description
toString()             Converts a Boolean value to a string, and returns the result
valueOf()             Returns the primitive value of a Boolean object

Date Object

The Date object is used to work with dates and times.
Date objects are created with new Date().
There are four ways of instantiating a date:
var d = new Date();
var d = new Date(milliseconds);
var d = new Date(dateString);
var d = new Date(year, month, day, hours, minutes, seconds, milliseconds);
For a tutorial about date and times, read our JavaScript Date Object tutorial.

Date Object Properties

Property                                                              Description

constructor         Returns the function that created the Date object's prototype
prototype           Allows you to add properties and methods to an object

Date Object Methods

Method                                                               Description

getDate()            Returns the day of the month (from 1-31)
getDay()              Returns the day of the week (from 0-6)
getFullYear()      Returns the year (four digits)
getHours()          Returns the hour (from 0-23)
getMinutes()     Returns the minutes (from 0-59)
getMonth()        Returns the month (from 0-11)
getSeconds()     Returns the seconds (from 0-59)
getTime()            Returns the number of milliseconds since midnight Jan 1, 1970
getUTCDate()    Returns the day of the month, according to universal time (from 1-31)
toDateString()   Converts the date portion of a Date object into a readable string
toTimeString()   Converts the time portion of a Date object to a string
valueOf()             Returns the primitive value of a Date object

Math Object

Math is not a constructor. All properties/methods of Math can be called by using Math as an object, without creating it.

Syntax

var x = Math.PI; // Returns PI
var y = Math.sqrt(16); // Returns the square root of 16

Math Object Properties

Property              Description

E              Returns Euler's number (approx. 2.718)
LN2        Returns the natural logarithm of 2 (approx. 0.693)
LN10      Returns the natural logarithm of 10 (approx. 2.302)
LOG2E   Returns the base-2 logarithm of E (approx. 1.442)

Math Object Methods

Method                                               Description

abs(x)                   Returns the absolute value of x
asin(x)                  Returns the arcsine of x, in radians
ceil(x)                    Returns x, rounded upwards to the nearest integer
log(x)                    Returns the natural logarithm (base E) of x

Number Object

The Number object is an object wrapper for primitive numeric values.
Number objects are created with new Number().

Syntax

var num = new Number(value);
Number Object Properties

Property                                              Description

constructor         Returns the function that created the Number object's prototype
MAX_VALUE      Returns the largest number possible in JavaScript
MIN_VALUE       Returns the smallest number possible in JavaScript
prototype           Allows you to add properties and methods to an object

Number Object Methods
Method                                                               Description

toFixed(x)           Formats a number with x numbers of digits after the decimal point
toString()             Converts a Number object to a string
valueOf()             Returns the primitive value of a Number object

String Object

The String object is used to manipulate a stored piece of text.
String objects are created with new String().

Syntax

var txt = new String("string");
or more simply:
var txt = "string";
For a tutorial about the String object, read our JavaScript String Object tutorial.

String Object Properties

Property                                              Description

constructor         Returns the function that created the String object's prototype
length                   Returns the length of a string
prototype           Allows you to add properties and methods to an object

String Object Methods

Method                                               Description
charAt()               Returns the character at the specified index
charCodeAt()     Returns the Unicode of the character at the specified index
concat()               Joins two or more strings, and returns a copy of the joined strings
indexOf()            Returns the position of the first found occurrence of a specified value in a string

JavaScript Global Properties

Property                              Description
Infinity  A numeric value that represents positive/negative infinity
NaN       "Not-a-Number" value
undefined           Indicates that a variable has not been assigned a value

JavaScript Global Functions

Function                                              Description

decodeURI()                      Decodes a URI
encodeURI()      Encodes a URI
escape()              Encodes a string
eval()                    Evaluates a string and executes it as if it was script code
isFinite()              Determines whether a value is a finite, legal number
isNaN()                 Determines whether a value is an illegal number
Number()            Converts an object's value to a number