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 2 of 2

Thread: Help needed on basics of Methods- Written non written

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help needed on basics of Methods- Written non written

    I have problem with this code, it is throwing error on g.get(): this particular line

    String str = g.get(); // "HI GENEVIVE"


    This is the code


    class genevive {

    String get( ) {

    return "Hi Genive";
    }

    }

    public class Test1 {

    public static void main(String[] args) {

    Genive g = new Genive();

    String str = g.get(); // "HI GENEVIVE"

    System.out.println(str);

    }

    }


  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: Help needed on basics of Methods- Written non written

    Please post your code in code tags.

    The class name and reference to it are not the same. Not only are they spelled differently, but case also matters.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    derekxec (September 14th, 2013)

Similar Threads

  1. Self written timer with System.nanoTime()
    By ICEPower in forum What's Wrong With My Code?
    Replies: 1
    Last Post: May 1st, 2013, 07:33 AM
  2. Code Written In Servelet Is Not Working
    By anandpatil in forum Java Servlet
    Replies: 0
    Last Post: January 10th, 2013, 08:09 AM
  3. I NEED A WRITTEN CODE
    By samy222 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 22nd, 2010, 05:28 PM
  4. need this program written
    By damajicman3 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 6th, 2010, 03:19 PM