Thursday, 6 February 2014

ICSE 10th Standard Notes – Some Operators in Java

Ternary Operator :

Ternary Operators are also called as Conditional Operator. The operators used in the ternary operator are?: .
Syntax : expression1 ? expression2 : expression3;

Example : result = mks>=40 ? “PASS” : “FAIL”;

The Square Bracket [ ] Operator :

The square Brackets are used to create, declare and access the Array Elements.

Example : int a[ ] = new int [ 10 ];

The Dot Operator :

The dot operator are used to access the instance members of an object or the class members of the class.

Example :;

The Parenthesis ( ) Operator :

The Parenthesis Operator are used to declare a function or call a method. Argument list is specified in the Parenthesis. If there are no arguments then the Parenthesis can be empty.

Example : function_name();

The new Operator :

The new operator is used to create a new object or an Array.

Example : int a[ ] = new int [ 10 ];

Example : class_name object = new class_name();

The instanceof Operator :

The instanceof Operator tests whether the first operand is the instance of the second operand.

Example : a instanceof b;

Get Ebooks delivered to your email id


Subscribe to our channel


Powered by Blogger.

Home | Contact Us | DMCA | Terms of Service | Privacy | Advertise

Maven Scientists