Results 1 to 3 of 3
  1. #1
    one198 is offline Member
    Join Date
    Aug 2007
    Posts
    15
    Rep Power
    0

    Default

    Dear Friends

    I wrote below coding for a learn the java.I wanna call play method inside the Sing method.but i got error message.How i do this.
    Java Code:
    public class Student{
    public void Play(){
    System.out.println("Child is playing");
    }
    public void Sing(){
    
     play();
    System.out.println("Child is singing");
    }
    }
    public class Test40
    {
    
    public static void main(String[] args)
    {
    Student St1=new Student();
    St1.Sing();
    
    }
    }
    Error message is

    Test40.java7:cannot find symbol
    symbol :method play()
    location:class Student
    play();


    pls help me
    Thank you
    Last edited by one198; 10-12-2007 at 01:37 PM.

  2. #2
    dmacvittie is offline Member
    Join Date
    Aug 2007
    Posts
    30
    Rep Power
    0

    Default

    Hey One198,

    You're nearly there! Java is case sensitive, so just change "p" in the call to "Play" to be "P".

    Note that it is Java convention (though not required by the compiler) to only capitalize the first letter of class and interface names - so "Play" should be "play", and "Sing" should be "sing". But as I say, this is only convention and it should work fine without doing that as long as you use the same capitalization throughout.

    Don.
    Don MacVittie F5 Networks - DevCentral

  3. #3
    one198 is offline Member
    Join Date
    Aug 2007
    Posts
    15
    Rep Power
    0

Similar Threads

  1. Coding an FTP server in java
    By Zucheto in forum Networking
    Replies: 3
    Last Post: 06-22-2008, 05:24 AM
  2. Help On Coding problem
    By mandrake446 in forum New To Java
    Replies: 3
    Last Post: 12-08-2007, 08:01 AM
  3. Cannot solve the coding problem of my assignment
    By elimmom in forum New To Java
    Replies: 3
    Last Post: 08-13-2007, 12:33 PM
  4. Problem in my coding
    By one198 in forum New To Java
    Replies: 9
    Last Post: 08-09-2007, 11:07 AM
  5. Help with program coding
    By cachi in forum AWT / Swing
    Replies: 1
    Last Post: 07-31-2007, 08:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •