Skip to content
Algorithms
  • Home
  • IDE
  • Site Map
  • Difficulty Level
    • Beginner
    • Intermediate
    • Expert
  • Interviews
    • Amazon Questions
    • Goldman Sachs
    • Google Interview
    • Microsoft Interview
    • Apache
    • NetApp
    • Adobe
    • Facebook
    • NVIDIA
    • Oracle

Print My IP Address – Java Code

September 1, 2019July 31, 2018 by Sumit Jain

Objective: Write a java program to print your IP address.

Approach:

  • Get the local host address of your system using getLocalHost() method.
  • Use getHostAddress() method to get the IP address from local host address.

Code:


Output:

IP ADDRESS is : 192.162.1.9

Related Posts:

  • Print All Paths in Dijkstra's Shortest Path Algorithm
  • Print Number with its Sign in Java
  • Print all Unique elements in a given array
  • Java Program to determine if Given Year is Leap Year
  • Find Factorial of a given Number
  • Generate all the strings of length n from 0 to k-1.
  • Print all nested directories and files in a given directory - Recursion
  • Print Numbers from 1 to N without using loop
  • Print maximum occurring character in a String
  • Print First N Prime Numbers - Java Code
  • Print all subarrays using recursion
  • Print all middle elements of the given matrix/2D array.
  • Check if Given Number is power of 2.
  • Fizz Buzz Challenge - Java Implementation
  • Product of all Unique elements in a given array.
Categories Beginner, Java Concepts, MISC Tags Beginner Leave a comment
Post navigation
Find the Circumference of a Circle – Java Program
Print First N Prime Numbers – Java Code



More Problems

  • Print all subarrays using recursion
  • Print all middle elements of the given matrix/2D array.
  • Check if Given Number is power of 2.
  • Fizz Buzz Challenge - Java Implementation
  • Product of all Unique elements in a given array.
  • Print boundary of given matrix/2D array.
  • Java Program to find if Triangle can be formed using given 3 sides
  • Number's Complement - 2 Approaches
  • Sum of all Unique elements in a given array
  • Find the Area and Perimeter of Rectangle – Java Program




Subscribe ( No Spam!!)

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,419 other subscribers

Recent Posts

  • Find departure and destination cities from the itinerary
  • Rank Array Elements
  • Three Consecutive Odd Numbers
  • Non-decreasing Array with one allowed change
  • Duplicate zero’s without expanding the array.
  • Maximum Depth of Valid Nested Parentheses
  • Decimal to Binary
  • Maximum Consecutive Ones
  • Duplicate even elements in an array
  • Minimum Increments to make all array elements unique






© 2021 Algorithms • Powered by GeneratePress