The following example uses a
Class
object to print the class name of an object=======================================================
package source;
class calculate{
void print(){
System.out.println("inside print");
}
}
public class Employee {
public static void main(String args[]){
calculate obj=new calculate();
System.out.println(obj.getClass().getName()); //source.calculate
}
}
=================================================
No comments:
Post a Comment