Results 1 to 3 of 3
Thread: Error in my coding
- 10-12-2007, 09:08 AM #1
Member
- Join Date
- Aug 2007
- Posts
- 15
- Rep Power
- 0
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.
Error message isJava 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(); } }
Test40.java7:cannot find symbol
symbol :method play()
location:class Student
play();
pls help me
Thank youLast edited by one198; 10-12-2007 at 12:37 PM.
- 10-12-2007, 05:25 PM #2
Member
- Join Date
- Aug 2007
- Posts
- 30
- Rep Power
- 0
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
- 10-13-2007, 05:07 AM #3
Member
- Join Date
- Aug 2007
- Posts
- 15
- Rep Power
- 0
Similar Threads
-
Coding an FTP server in java
By Zucheto in forum NetworkingReplies: 3Last Post: 06-22-2008, 04:24 AM -
Help On Coding problem
By mandrake446 in forum New To JavaReplies: 3Last Post: 12-08-2007, 07:01 AM -
Cannot solve the coding problem of my assignment
By elimmom in forum New To JavaReplies: 3Last Post: 08-13-2007, 11:33 AM -
Problem in my coding
By one198 in forum New To JavaReplies: 9Last Post: 08-09-2007, 10:07 AM -
Help with program coding
By cachi in forum AWT / SwingReplies: 1Last Post: 07-31-2007, 07:16 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks