refelction_getClasssName.htm |
Refection has the ability to retrieve
information about the object during runtime :
|
reflection getclassname() |
|
![]() |
import java.io.*; //import java.awt.Color; import java.net.*; //import java.lang.reflect.*; class Test_this { static public void main( String[] args ) { process_this tt = new process_this(); Test_this.printName(tt); } static void printName(Object o) { Class c = o.getClass(); String s = c.getName(); System.out.println(s); } } class process_this { //public String str = "manas6"; public static void method_socket_address(String str2)throws IOException { InetAddress address2 = InetAddress.getByName(str2); System.out.println("Remote server is http:// "+ address2); System.out.println("Remote server name : "+ address2.getHostName()); System.out.println("Remote server IP : "+ address2.getHostAddress()); } } |
![]() |
|
![]() |
|
![]() |