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

Thread: what do they mean "call a method named myInfo"

  1. #1
    Junior Member
    Join Date
    Nov 2012
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default what do they mean "call a method named myInfo"

    HI i am a bit new to java and I am not sure about methods. I was hoping if someone can give me an example

    this is what its asking


    Variable Name Variable Contents
    myName = place your name here
    creditsTaken = place your credits taken this semester
    totalCredits = place your total amount of credits taken
    GPA = place your current GPA
    major = place your major
    className = place the name of this class

    - Call a method named myInfo PASSING the previous variables





    and this is what I have I am not sure what they mean by asking "call a method named myInfo"




    public static void main(String[] args) {



    String myName, Major, className;
    Double creditsTaken, totalCredits, GPA;
    int maxValue, addNumbers;

    myName = "william";
    Major = "information technology";
    className = "operating Systems";


    creditsTaken = 9.0;
    totalCredits = 70.0;
    GPA = 3.1;

    maxValue = 100;




    addNumbers = maxValue;








    System.out.println();
    System.out.println("hello my name is.... " + myName);

    System.out.println("my major is.... " + Major);

    System.out.println("I have completed " + totalCredits + " credits so far");

    System.out.println("I am taking " + creditsTaken + " credits this semester");

    System.out.println("This class name is...... " + className);
    System.out.println();

    System.out.println(addNumbers + 1);


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: what do they mean "call a method named myInfo"

    what they mean by asking "call a method named myInfo"
    Here is a statement that calls a method named println:
    System.out.println("hello my name is.... " + myName);

    Also see the tutorial:
    http://docs.oracle.com/javase/tutori...arguments.html
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: what do they mean "call a method named myInfo"

    This thread has been cross posted here:

    http://www.java-forums.org/new-java/67966-what-do-they-mean-call-method-called-myinfo.html

    Although cross posting is allowed, for everyone's benefit, please read:

    Java Programming Forums Cross Posting Rules

    The Problems With Cross Posting

    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  4. #4
    Junior Member
    Join Date
    Nov 2012
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: what do they mean "call a method named myInfo"

    Quote Originally Posted by Norm View Post
    Here is a statement that calls a method named println:
    System.out.println("hello my name is.... " + myName);

    Also see the tutorial:
    Passing Information to a Method or a Constructor (The Java™ Tutorials > Learning the Java Language > Classes and Objects)


    wait huh?I am sorry =( I don't get it. So, I put System.out.myName ??

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: what do they mean "call a method named myInfo"

    Where is the method located? If it's in the same class as you are calling it from you don't need the class reference to call it.
    System.out is a reference to a class that contains the println() method.
    If you don't understand my answer, don't ignore it, ask a question.

  6. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: what do they mean "call a method named myInfo"

    Please stop posting duplicate threads. I've deleted your identical question from the IDE forum. Continued spam and crossposting will get you banned.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    Junior Member
    Join Date
    Nov 2012
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: what do they mean "call a method named myInfo"

    Quote Originally Posted by KevinWorkman View Post
    Please stop posting duplicate threads. I've deleted your identical question from the IDE forum. Continued spam and crossposting will get you banned.

    Ive been replying to this post thread all along. I am not writing anywhere else, so dont know what you are talking about

  8. #8
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: what do they mean "call a method named myInfo"

    Quote Originally Posted by willc86 View Post
    Ive been replying to this post thread all along. I am not writing anywhere else, so dont know what you are talking about
    You posted an identical thread in the IDE forum, which I have deleted. It might have been an accident, unlike the crossposting. Anyway, I'd suggest following Norm's advice and answering his questions.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Can't call "paint" method from other method
    By aslanali555 in forum Object Oriented Programming
    Replies: 8
    Last Post: November 19th, 2012, 05:53 AM
  2. Can't call "paint" method from other method
    By aslanali555 in forum Object Oriented Programming
    Replies: 1
    Last Post: November 17th, 2012, 01:30 PM
  3. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  4. Replies: 7
    Last Post: August 13th, 2011, 01:22 AM
  5. "Static method cannot hide instance method from implemented Interface"
    By Gthoma2 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 21st, 2011, 03:03 AM