Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: cannot return the value\

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default cannot return the value\

    import java.io.Console;
    import java.net.InetAddress;

    public class MyResolvingDNS1
    {
    public static void main(String args[]) throws Exception
    {
    Console cons = System.console();
    System.out.println("Enter url or type exit");
    String dns = cons.readLine();

    while(!dns.equals("exit"))
    {
    InetAddress addr = InetAddress.getByName(dns);
    String host = addr.getHostAddress();
    System.out.println(host+" : " +dns);
    return dns;

    }
    }
    }






    how i want to return the value of "dns" ..
    already stuck
    please somebody help me


  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default cannot return the value

    import java.io.Console;
    import java.net.InetAddress;

    public class MyResolvingDNS1
    {
    public static void main(String args[]) throws Exception
    {
    Console cons = System.console();
    System.out.println("Enter url or type exit");
    String dns = cons.readLine();

    while(!dns.equals("exit"))
    {
    InetAddress addr = InetAddress.getByName(dns);
    String host = addr.getHostAddress();
    System.out.println(host+" : " +dns);
    return dns;

    }
    }
    }






    how i want to return the value of "dns" ..
    already stuck
    please somebody help me

  3. #3
    Member
    Join Date
    Sep 2012
    Posts
    128
    Thanks
    1
    Thanked 14 Times in 14 Posts

    Default Re: cannot return the value

    Where do you want to return the dns variable to?

  4. #4
    Junior Member
    Join Date
    Mar 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: cannot return the value

    i want to make as long as user not type "exit"
    it still can running..
    but how i want to return the console ...?
    so user can check inetaddress for other website...

Similar Threads

  1. [SOLVED] return
    By dipakshah8944 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: July 16th, 2012, 12:21 AM
  2. return help
    By Kalle in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 21st, 2012, 05:33 PM
  3. return;
    By tarkal in forum Java Theory & Questions
    Replies: 3
    Last Post: November 26th, 2011, 10:53 AM
  4. Return Object does not return the expected output
    By Nour Damer in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 13th, 2011, 07:24 AM
  5. how to return value ..
    By gr8mind in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 11th, 2011, 05:27 AM