Which operator is used to access methods and properties of a class?
Answers
Answered by
0
To access any method or properties of a class dot(.) operator is used.
Answered by
0
Answer:
Dot( .) operator is used to access methods and properties of a class in java.
Example of dot operator:
class A
{
int x, y;
void getdata( int a, int b)
{
x= a;
y= b;
}
int add ( )
{
return ( x+y );
}
}
class Main_class
{
public static void main ( string args[] )
{
A obj = new A( );
int p;
p= obj. add( ); // here we use . (dot) operator
system.out. println( add );
}
}
Similar questions