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: Trouble with my URL

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Trouble with my URL

    The Test
    public class URLTester {
    public static void main(String[] args) {
    String basurl = "webbadress";
    String[] rubriker = {
    "Nu Kommer Vintern till Åland",
    "Önskningar är något man vill uppnå",
    "Just English Letters"
    };
    for (String rubrik : rubriker) {
    URLTransformer transformer = new URLTransformer(basurl, rubrik);
    String url = transformer.getURL();
    String aElement = transformer.getAElement();
    System.out.println(rubrik);
    System.out.println(url);
    System.out.println(aElement);
    }
    }

    My code
    public class URLTransformer {
        public String url;
        public String AElement;
        public String rubrik;       
     
        public URLTransformer(String basurl, String rubriker){      
        }   
        String getURL() {  
            return url;
        } 
        String getAElement(){
            return AElement;    
        }
        String getRubrik(){
            return rubrik;
        }   
    }

    And the result should be
    Nu Kommer Vinter till Åland
    webbadress
    <a href ="webbadress">Nu Kommer Vintern till Åland</a>
    Önskningar är något man vill uppnå
    webbadress
    <a href ="webbadress">Önskningar är något man vill uppnå</a>
    Just English Letters
    webbadress
    <a href ="webbadress</a>


    Iam a beginner and I don't actually know whats the problem to fix it. The http/.. should be click able but the "run" shows me:
    Nu Kommer Vintern till Åland
    null
    null
    Önskningar är något man vill uppnå
    null
    null
    Just English Letters
    null
    null
    BUILD SUCCESSFUL (total time: 0 seconds)


    I know it's something missing but I don't actually know what, need help to solve the problem
    Thank you


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Trouble with my URL

    Welcome to the forum. Thank you for taking the time to learn to post correctly.

  3. #3
    Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    62
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: Trouble with my URL

    Please check the constructor public URLTransformer(String basurl, String rubriker)

    You missed to set to values basurl and rubriker to members of URLTransformer class.
    Thanks and regards,
    Sambit Swain

  4. #4
    Junior Member
    Join Date
    Feb 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Trouble with my URL

    Hmm ok I will see =) but thanks anyway.

Similar Threads

  1. Url Image stream? Getting an Image url.
    By turtlemaster in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: June 30th, 2012, 09:43 AM
  2. BlueJ trouble or program trouble (Combining Arraylists)
    By star12345645 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 11th, 2012, 12:15 PM
  3. url
    By nasi in forum Java Theory & Questions
    Replies: 3
    Last Post: April 12th, 2010, 02:43 AM
  4. how to get url?
    By chinni in forum Java Networking
    Replies: 2
    Last Post: November 4th, 2009, 12:06 PM