Wednesday, September 28, 2016

New Operator:-

New operator is used for creating a object to the class. Syntax:- class name obj = new class name(); Eg:- Employee e = new Employee();

Cast Operator:-

It is used to convert the data from one data type to another data type. Eg:- double q = 26.546; int x = (int)a; Lets see a example program on cast operator class Cast { public Static void main(String args[]); { double a = 26.546; System.Out.println("the value of a=" +a); int x=(int)a; System.Out.println("the value of x=" +x); } }

No comments:

Post a Comment