Friday, May 7, 2021

Adv. Java Slip1

 

  1. Slip1

    Q 1 Write a java program to display IP Address and Name of client machine.  


  2. import java.net.InetAddress;

  1. public class Slip1 {

  1.       public static void main(String[] args)

  1.          throws Exception {

  1.                 InetAddress IP = InetAddress.getLocalHost();

  1.                 System.out.println("Local HostAddress:  "+IP.getHostAddress());

  1.                 String hostname = IP.getHostName();

  1.                 System.out.println("Local host name: "+hostname);

  1.       }

  1. }

OUTPUT

C:\>javac Slip1.java

C:\>java Slip1
Local HostAddress:  192.168.43.123
Local host name: NEW-PC




No comments:

Post a Comment

Slip 10. Write a jQuery code to make first word of each statement to bold.

  Slip 10. Write a jQuery code to make first word of each statement to bold.  <!DOCTYPE html> <html>   <head>     <scri...